Re: Storing images in PG?
От | Karel Zak |
---|---|
Тема | Re: Storing images in PG? |
Дата | |
Msg-id | 20010816100200.A29792@zf.jcu.cz обсуждение исходный текст |
Ответ на | Storing images in PG? ("Dr. Evil" <drevil@sidereal.kz>) |
Ответы |
Re: Re: Storing images in PG?
|
Список | pgsql-general |
On Thu, Aug 16, 2001 at 06:02:00AM -0000, Dr. Evil wrote: > > > I am creating a DB which is going to have to store a lot of small > images. Nothing will be over 10k. This is with PG7.2. I have a few > questions: Should I use blob or bytea (neither seem to be well > documented), and how do I access that binary information? For > instance, if I have this table in PG: > > CREATE TABLE imagetable ( > .... > image BYTEA, > .... > ); > > and then I do this in PHP: > > $result = pg_exec($db, "SELECT image FROM imagetable WHERE ..."); > $ary = pg_fetch_array($result, 0); > $imagedata = $ary["image"]; > > Will all of the above work? Yes, but good is encode binary data (image) to same ascii safe encoding like base64, else you will have problem in INSERT/UPDATE queries. Karel -- Karel Zak <zakkr@zf.jcu.cz> http://home.zf.jcu.cz/~zakkr/ C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz
В списке pgsql-general по дате отправления: