Getting image from a DB

From: Félix Sánchez Rodríguez <fesanch(at)ciego(dot)cult(dot)cu>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Getting image from a DB
Date: 2009-05-07 18:16:43
Message-ID: 006101c9cf3f$fa877380$3000a8c0@atenea
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi:

Has anybody here had to capture an image from a PostgreSQL Data Base using PHP?? I used a simple query: select photo from people where id = 3, for instance. The problem is that when I write the image to disk it's not a valid image. I opened it using an HEX editor and saw that the question is that for each "strange" character, like ÿ, it writes, for instance, \377, it is, the "\" symbol plus the character's numeric code. I guessed that there were some function for this situation but I couldn't find it. If you can't help me, I'll have to parse the whole image contents, with the subsequent performance impact.

PD: The image field is of type bytea,as you recommend me.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Eddy Ernesto Baños Fernández 2009-05-07 19:56:43 Use_Connection_pooling
Previous Message Joshua D. Drake 2009-05-07 16:58:04 Re: How to run PostgreSQL?