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: Re: Re: Storing images in PG? "Eric Ridge" <ebr@tcdi.com>
RE: Re: Re: Storing images in PG? Lee Kindness <lkindness@csl.co.uk>
Re: Re: Re: Storing images in PG? Gunnar Rønning <gunnar@polygnosis.com>
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 по дате отправления
От: Kenji Sugita
Дата:
От: Andrew SNow
Дата:
Сообщение: RE: Re: Storing images in PG?
FAQ