Jason Wong wrote:
On Tuesday 02 November 2004 03:36, P. George wrote:
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?
You probably don't want to use bytea as it will use a lot of ram for larger images.
Instead you will want to look at large objects. The functions you want are:
*pg_loreadall()* *pg_lo_read_all()* <http://www.php.net/manual/en/function.pg-lo-read-all.php>
*pg_locreate()* *pg_lo_create()* <http://www.php.net/manual/en/function.pg-lo-create.php>
*pg_lounlink()* *pg_lo_unlink()* <http://www.php.net/manual/en/function.pg-lo-unlink.php>
*pg_loopen()* *pg_lo_open()* <http://www.php.net/manual/en/function.pg-lo-open.php>
*pg_loclose()* *pg_lo_close()* <http://www.php.net/manual/en/function.pg-lo-close.php>
*pg_loread()* *pg_lo_read()* <http://www.php.net/manual/en/function.pg-lo-read.php>
*pg_lowrite()* *pg_lo_write()* <http://www.php.net/manual/en/function.pg-lo-write.php>
*pg_loimport()* *pg_lo_import()* <http://www.php.net/manual/en/function.pg-lo-import.php>
*pg_loexport()* *pg_lo_export()* <http://www.php.net/manual/en/function.pg-lo-export.php>
Sincerely,
Joshua D. Drake
Yes.
if so, how?
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()
-- Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC Postgresql support, programming shared hosting and dedicated hosting. +1-503-667-4564 - jd@xxxxxxxxxxxxxxxxx - http://www.commandprompt.com PostgreSQL Replicator -- production quality replication for PostgreSQL
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php