Re: [GENERAL] DISPLAYING BLOBS/images/text

From: dustin sallings <dustin(at)spy(dot)net>
To: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
Cc: Martin Wong <martin(at)minook(dot)com(dot)sg>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] DISPLAYING BLOBS/images/text
Date: 1999-01-24 16:59:54
Message-ID: Pine.NEB.4.02.9901240853040.19668-100000@dhcp-199.west.spy.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 24 Jan 1999, Herouth Maoz wrote:

It actually gets cooler if you're using Netscape 4.5 because you
don't need two CGIs. Check out http://bleu.west.spy.net/~dustin/photo/
with Netscape 4.5 (it does the ol' two CGI thing otherwise).

// Well, what I would have done is:
//
// (a) Create a small CGI which, given sufficient parameters to locate the
// specific BLOB (OID, I suppose, but cases vary), reads it using
// lo_read() and dumps what it reads to its standard output.
//
// (b) Note that this CGI should return the appropriate MIME type in its
// Content-type line. For example, if the image is a JPEG image, its
// standard output should start with "Content-type: image/jpeg".
//
// (c) You could actually make it general-purpose by giving it the content
// type as a parameter. This way it blindly gives the given content
// type and dumps the given large object, so it can be used for both
// image applications and text applications implemented with large
// objects.
//
// In short, you should have a cgi whose URL may look something like:
//
// http://my.domain.com/cgi-bin/lo-dumper.cgi?oid=NNNNN&mime=image/jpeg
//
// When you have one, you can use it as your image source. Just write your
// image output with the above URL as its source:
//
// <IMG SRC="/cgi-bin/lo-dumper(dot)cgi?oid=123456(at)mime=image/jpeg"
// WIDTH=100 HEIGHT=40 ALT="Image of a bear">
//
// How did all the parameters get there? Well, I assume that anybody holding
// an image database will have an image table, which has fields for the image
// name or details (which can be used in the ALT), its width and height, and
// if there are several image types, also its type (jpeg, gif, png).
//
// So, at the bottom line, you have two CGIs. One CGI is the one you already
// had - the one that displays the HTML that surrounds the image, as well as
// selecting which image to display. In this case, this CGI will have to have
// a select statement of the general form:
//
// SELECT image_lo, image_type, width, height, description
// FROM image_table
// WHERE ....;
//
// And it should then print out the call to the other CGI in the form of an
// IMG tag as before, based on the details retrieved in the above select
// statement.
//
// You make your choice of languague for writing those two CGIs (or servlets).
//
// Hope this gives you a more complete picture of how things should be done
// for direct display of images.
//
// Herouth
//
// --
// Herouth Maoz, Internet developer.
// Open University of Israel - Telem project
// http://telem.openu.ac.il/~herutma
//
//
//
//

--
Principle Member Technical Staff, beyond.com The world is watching America,
pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin(at)spy(dot)net>
| Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE
L______________________________________________ and America is watching TV. __

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paolo P. Lo Giacco 1999-01-24 17:17:16
Previous Message Robert Nosko 1999-01-24 11:03:53 Agents