Re: [PHP-DB] can i display an image _directly_ from postgres db storage?
$result = pg_exec($dbconn, "SELECT $image FROM thetable where name='$name'); nevermind. i had a missing double-quote on this line. works great now. thanks. - philip -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] can i display an image _directly_ from postgres db storage?
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: $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
Re: [PHP-DB] can i display an image _directly_ from postgres db storage?
Typically, it's infinitely more performance-friendly to simply store your files on the hard disk and use the database to refer to that location. For instance, assume your root web dir is /www. Inside there you have an /images directory. If you religiously put all files inside of /images you can store the file name inside the DB and simply have your code output the proper HTML. Or, if you have to actually do image processing, you can have your code query the DB and then read the file into an image handler for GD or whatever you're using to do the processing. Either way, it's usually encouraged not to store BLOBs whenever possible due to the performance hit that's usually associated with that. although it's a kind gesture to worry about my site's performance, i would still like to find out how to do this and maybe test the performance myself. also, note that i'd like to be able to do this without the use of apache's cocoon database reader, as i doubt my lame webhost would install that for me. - philip -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] can i display an image _directly_ from postgres db storage?
i know that postgres has a raw binary datatype called bytea for storing pictures and whatnot, but i'm having trouble finding an example of displaying an image on a web page with php that is pulled directly from the database? is this possible? if so, how? thanks. - philip -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php