Re: Inserting .png file into bytea column - Mailing list pgsql-admin

From Dorian Machado
Subject Re: Inserting .png file into bytea column
Date
Msg-id CAFLCYiroy=BjX854JLH+NQQfGG0KkST6=hqCY0D2huj1ncM2DQ@mail.gmail.com
Whole thread Raw
In response to Re: Inserting .png file into bytea column  (Craig James <cjames@emolecules.com>)
List 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) . '" />';

pgsql-admin by date:

Previous
From: "Ferrell, Denise D CTR NSWCDD, H11"
Date:
Subject: Re: [Non-DoD Source] Re: Inserting .png file into bytea column
Next
From: Thomas Kellerer
Date:
Subject: Re: Inserting .png file into bytea column