From: | Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> |
---|---|
To: | "Dr(dot) Evil" <drevil(at)sidereal(dot)kz> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Storing images in PG? |
Date: | 2001-08-16 08:02:00 |
Message-ID: | 20010816100200.A29792@zf.jcu.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/
C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz
From | Date | Subject | |
---|---|---|---|
Next Message | Mark kirkwood | 2001-08-16 08:27:07 | Re :MySQL Benchmark page - Problem with vacuum() in PostgreSQL |
Previous Message | Dr. Evil | 2001-08-16 06:02:00 | Storing images in PG? |