Re: Storing images as BYTEA or large objects

From: "Gevik Babakhani" <pgdev(at)xs4all(dot)nl>
To: "'Koen Vermeer'" <koen(at)vermeer(dot)tv>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Storing images as BYTEA or large objects
Date: 2008-02-13 08:57:49
Message-ID: 001101c86e1e$82c19ca0$0a01a8c0@gevmus
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Regards,
Gevik Babakhani
------------------------------------------------
PostgreSQL NL http://www.postgresql.nl
TrueSoftware BV http://www.truesoftware.nl
------------------------------------------------

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Koen Vermeer
> Sent: Wednesday, February 13, 2008 9:43 AM
> To: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Storing images as BYTEA or large objects
>
> On Tue, 2008-02-12 at 17:16 -0700, Leonel Nunez wrote:
> > > My two questions are: Is this summary correct? And: Which method
> > > should I choose?
> > With Java , Python , Perl you've got functions that
> escapes the data
> > for you
>
> What about C++ and PHP?
>
> Koen
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Koen Vermeer 2008-02-13 09:19:14 Re: Storing images as BYTEA or large objects
Previous Message Koen Vermeer 2008-02-13 08:48:44 Re: Storing images as BYTEA or large objects