BLOB help needed...

Started by Taber, Markalmost 22 years ago3 messagesgeneral
Jump to latest
#1Taber, Mark
Mark.Taber@dof.ca.gov

We're implementing our first PostgreSQL database, and enjoying it very much.
However, we have a table that will store binary image files (pie charts,
etc.) for later display on a dynamic webpage. While we're putting together
our prototype application, I've been asked by the programmers (I'm the DBA)
to "put the images in the database." I can see how to do this using Large
Objects, but then getting them out again seems problematic, and the
documentation is a bit sketchy. Would BYTEA columns be better? However, it
seems to me that there is no easy way using psql to load images into a BYTEA
column. Any help would be greatly appreciated.

Regards,

Mark Taber

State of California

Department of Finance

Infrastructure & Architecture Unit

916.323.3104 x 2945

#2Guy Fraser
guy@incentre.net
In reply to: Taber, Mark (#1)
Re: BLOB help needed...

If you are using php, the two functions below should help.

http://ca.php.net/manual/en/function.pg-escape-bytea.php
http://ca.php.net/manual/en/function.pg-unescape-bytea.php

Taber, Mark wrote:

Show quoted text

We�re implementing our first PostgreSQL database, and enjoying it very
much. However, we have a table that will store binary image files (pie
charts, etc.) for later display on a dynamic webpage. While we�re
putting together our prototype application, I�ve been asked by the
programmers (I�m the DBA) to �put the images in the database.� I can
see how to do this using Large Objects, but then getting them out
again seems problematic, and the documentation is a bit sketchy. Would
BYTEA columns be better? However, it seems to me that there is no easy
way using psql to load images into a BYTEA column. Any help would be
greatly appreciated.

Regards,

Mark Taber

State of California

Department of Finance

Infrastructure & Architecture Unit

916.323.3104 x 2945

#3Development - multi.art.studio
dev.null@multiartstudio.com
In reply to: Guy Fraser (#2)
Re: BLOB help needed...

Hi,

i wrote a php skript to test this, works beautiful,

you can download the script at
http://www.erdtrabant.de/index.php?i=500200104

volker

Guy Fraser wrote:

Show quoted text

If you are using php, the two functions below should help.

http://ca.php.net/manual/en/function.pg-escape-bytea.php
http://ca.php.net/manual/en/function.pg-unescape-bytea.php

Taber, Mark wrote:

We�re implementing our first PostgreSQL database, and enjoying it
very much. However, we have a table that will store binary image
files (pie charts, etc.) for later display on a dynamic webpage.
While we�re putting together our prototype application, I�ve been
asked by the programmers (I�m the DBA) to �put the images in the
database.� I can see how to do this using Large Objects, but then
getting them out again seems problematic, and the documentation is a
bit sketchy. Would BYTEA columns be better? However, it seems to me
that there is no easy way using psql to load images into a BYTEA
column. Any help would be greatly appreciated.

Regards,

Mark Taber

State of California

Department of Finance

Infrastructure & Architecture Unit

916.323.3104 x 2945

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org