Re: Re: Storing images in PG?
От | Tod McQuillin |
---|---|
Тема | Re: Re: Storing images in PG? |
Дата | |
Msg-id | Pine.GSO.4.33.0108160339100.22208-100000@sysadmin обсуждение исходный текст |
Ответ на | Re: Storing images in PG? (Karel Zak <zakkr@zf.jcu.cz>) |
Ответы |
RE: Re: Storing images in PG?
|
Список | pgsql-general |
On Thu, 16 Aug 2001, Karel Zak wrote: > On Thu, Aug 16, 2001 at 06:02:00AM -0000, Dr. Evil wrote: > > > 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. If you encode with base64 you can use use varchar or text to store the data. Then what is the point of the 'bytea' type? Encoding/decoding base64 is a lot of overhead for large images (both in cpu time and disk space) -- is there no way to store and retrieve raw binary data for bytea columns? -- Tod McQuillin
В списке pgsql-general по дате отправления: