Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: OWS: how to retrive image from db?

Re: OWS: how to retrive image from db?

From: Nick Grossman <nick_at_ulster.net>
Date: Wed, 28 Apr 1999 16:06:09 -0400
Message-ID: <37276A31.CDBEFB10@ulster.net>


> I've got a web interface to the database
> (OWS on Solaris 2.5, Oracle 7.3) and
> I can see text strings from tables through a browser.
> But in some tables I store gif images in LONG RAW format.
> Is there a way to retrive pictures from database and
> see them in a browser? (A simple one is to store images on
> disk and call them through <img...> tag, but
> the images are already in database.)

Personally, i'd say it's more than worth your while to take them out of the database and get them via normal HTTP, it would take a lot of load off of everything.

> When I build html page, I use <img src="..."> tag (htp.img)
> to call the picture, where src="/servicename/owa/imageretriver".
>
> procedure imageretriver is
>
> cursor retriveimg is
> select img
> from image
> where n=1;
>
> imagebuff image.img%type;
>
> begin
> open retriveimg;
>
> fetch retriveimg into imagebuff;
>
> close retriveimg;
>
> htp.prn(imagebuff);
> end;
>
> end;

That being said, the reason you're getting the hex code rather than the actual GIF is that the MIME response header isn't being set properly.

If you call any htp procedure without setting your own MIME header, it will set it automatically of type text/html. You need it to be image/gif (or image/jpeg, image/png, etc.)

This should work:

...
owa_util.mime_header('image/gif');
htp.prn(imagebuff);
...

This will tell the browser that it has an image coming and that it should display it as such.

Cheers,
Nick Grossman Received on Wed Apr 28 1999 - 15:06:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US