Re: can i display an image _directly_ from postgres db storage?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tutorials that shows how to upload and store image/binary files in a database
also usually shows how to retrieve them (and in the case of images, also how
to display them).


One function you'll find useful is

imagecreatefromstring()


thanks.

i found an example for uploading an image into the proper database field, which ***seems*** to have worked.

and i found another example for pulling it back out to use directly in html code:

<?php
$dbconn = pg_connect("host=1.2.3.4 port=5432 dbname=mydb user=myname password=mypass");
$result = pg_exec($dbconn, "SELECT $image FROM thetable where name='$name');
$image = stripcslashes(pg_result($result, 0, 0));
header("content-type: image/gif");
echo $image;
?>


... BUT it's giving me the following error:

Parse error: parse error, unexpected T_STRING in /myfolder/gif.php on line 5

that's the header() line, but what could the problem be?

thanks.

- philip

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux