Re: Storing images in a field - Mailing list pgsql-general

From Richard Huxton
Subject Re: Storing images in a field
Date
Msg-id 200404191746.12825.dev@archonet.com
Whole thread Raw
In response to Storing images in a field  (Együd Csaba <csegyud@vnet.hu>)
List pgsql-general
On Monday 19 April 2004 16:28, Együd Csaba wrote:
> Hi All,
> I use PG 7.3.2 an 7.4.1 on RH 7.1.
> I'd like to store small (~ 100x100 px jpeg, or gif) images in a field in
> binary format.

> How can I insert a block of binary data into a given field form the client
> (WinXP, pgsqlODBC 7.03.01)? And on the other side how can I retrive that
> data from there, how can I delete or modifay that?
>
> In general which data type is the most powerful for this. The only purpose
> of this field to store a photo or drawing of the product represented by the
> record. It's not required to be parsed. Is it possible to have it
> compressed or it should be done by the client?

Well there are two options: bytea or text (where you encode the image yourself
to make sure it contains only permitted values - e.g. with base64). Which one
you use depends on your client code.

If you look in the mailing list archives you'll see plenty of discussion of
this.

--
  Richard Huxton
  Archonet Ltd

pgsql-general by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: Cursors and PHP
Next
From: "Froggy / Froggy Corp."
Date:
Subject: Postgresql 7.4.1 - Template database and user permission