Re: Inserting .png file into bytea column

From: Dorian Machado <dorian599(at)gmail(dot)com>
To: Craig James <cjames(at)emolecules(dot)com>
Cc: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>, "Ferrell, Denise D CTR NSWCDD, H11" <denise(dot)ferrell(dot)ctr(at)navy(dot)mil>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Inserting .png file into bytea column
Date: 2015-11-19 18:35:35
Message-ID: CAFLCYiroy=BjX854JLH+NQQfGG0KkST6=hqCY0D2huj1ncM2DQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hello

Try to use a TEXT column for the flags in the table.

You musto to encode the image has base64 and then to retrive the image to
the web you must to decode de content of the field.

It is a simple a easy way to store and retrive images from databases

For example

*For HTML*

<img alt="Embedded Image"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEEAAABBCAIAAAABlV4SAAAABGdBTUEAAK/INwWK6QAAABl0RVh0
U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAABJFSURBVHja1F . ." />

*For PHP*

echo '<img src="data:image/gif;base64,' . base64_decode($data) . '" />';

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Thomas Kellerer 2015-11-19 19:32:38 Re: Inserting .png file into bytea column
Previous Message Ferrell, Denise D CTR NSWCDD, H11 2015-11-19 15:20:59 Re: [Non-DoD Source] Re: Inserting .png file into bytea column