Re: Storing images as BYTEA or large objects

From: Koen Vermeer <koen(at)vermeer(dot)tv>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Storing images as BYTEA or large objects
Date: 2008-02-13 09:19:14
Message-ID: 1202894354.5251.15.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2008-02-13 at 09:57 +0100, Gevik Babakhani wrote:
> In hour case we where switching between databases so what I have done in the
> past was:
> For inserting:
> 1. create a TEXT column in my table. (In PG this can be 1GB in size)
> 2. read file contents in a buffer/string and Base64 encode that string.
> 3. write the string into db.
> For reading:
> 1. read the text column into a buffer/string Base64 decode to get your
> original image/binary data.
> The approach above worked for us. This was a PHP5 website and C# frontend.

Instead of base64 encoding, I guess it would be easier to just escape
the required bytes and store them in a bytea.

But, just to be clear: I think I can get both methods (lo or bytea) to
work. All I was trying to find out is which option would be better in my
case.

Best,
Koen

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Masse Jacques 2008-02-13 09:19:51 Re: dynamic crosstab
Previous Message Gevik Babakhani 2008-02-13 08:57:49 Re: Storing images as BYTEA or large objects