From: | Tod McQuillin <devin(at)spamcop(dot)net> |
---|---|
To: | Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> |
Cc: | "Dr(dot) Evil" <drevil(at)sidereal(dot)kz>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Re: Storing images in PG? |
Date: | 2001-08-16 08:41:25 |
Message-ID: | Pine.GSO.4.33.0108160339100.22208-100000@sysadmin |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew SNow | 2001-08-16 08:52:32 | RE: Re: Storing images in PG? |
Previous Message | Kenji Sugita | 2001-08-16 08:34:01 | The -o command line option of pg_dump for a database using foreign keys |