Re: [GENERAL] DISPLAYING BLOBS/images/text

Поиск
Список
Период
Сортировка
От dustin sallings
Тема Re: [GENERAL] DISPLAYING BLOBS/images/text
Дата
Msg-id Pine.NEB.4.02.9901240853040.19668-100000@dhcp-199.west.spy.net
обсуждение исходный текст
Ответ на Re: [GENERAL] DISPLAYING BLOBS/images/text  (Herouth Maoz <herouth@oumail.openu.ac.il>)
Список 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.cgi?oid=123456@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@spy.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. __


В списке pgsql-general по дате отправления:

Предыдущее
От: "Robert Nosko"
Дата:
Сообщение: Agents
Следующее
От: "Paolo P. Lo Giacco"
Дата:
Сообщение: ...