[PHP-DEV] Output binary Images/large objects?? From: Ed Blincoe (ed <email protected>)
Date: 01/21/00

I need to output binary images from a postgres large object field to a
browser, I attemped the following but it outputs rubbish. {i.e. untranslated
binary tosh}
------------- begin php3 file ---------------------
<html>
<body>

<?
$conn = pg_Connect("host=localhost port=5432 dbname=doc");
pg_exec($conn, "begin");
$news = pg_Exec($conn,"select
text_id,display_num,brand_num,page_num,content_obj from tblcontent");
#$news = pg_Exec($conn,"select
text_id,display_num,brand_num,page_num,content_obj from tblcontent");
$result_news = pg_NumRows($news);
$i = 0;
while($i < $result_news)
{
 $name = pg_Result($news,$i,"text_id");
 $email = pg_Result($news,$i,"display_num");
 $date = pg_Result($news,$i,"brand_num");
 $blurb = pg_Result($news,$i,"page_num");
 $ctobj = pg_Result($news,$i,"content_obj");
 $fhandle = pg_loopen($conn,$ctobj,"r");
 $img1 = pg_loreadall($fhandle);
 $size = pg_loread($fhandle);

 echo "<img scr=./gobber.jpg>";
 echo "$img1";
 $i++;
}
pg_exec($conn, "end");
?>
</body>
</html>
-------------------------End----------------------------

Any suggestions how this can be output directly to a web page or does this
need to go through the icon/images directory in some way??

--
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
To search the mailing list archive, go to:
http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin <email protected>

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>