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

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

Re: OWS: how to retrive image from db?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Tue, 27 Apr 1999 12:28:30 GMT
Message-ID: <372bad16.5675821@192.86.155.100>


A copy of this was sent to klimsamgin <klimsamgin_at_yahoo.com> (if that email address didn't require changing) On Tue, 27 Apr 1999 10:40:01 GMT, you wrote:

>Hi!
>
>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.)
>
>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);

         htp.prn( utl_raw.cast_to_varchar2(imagebuff) );

you need to silently convert the long raw into a varchar2 without doing the hex conversion. If UTL_RAW is not installed in your database, goto $ORACLE_HOME/rdbms/admin and look for "*raw*". You'll find a spec and a body. Install the spec when connected as SYS or INTERNAL (only as SYS or INTERNAL, not as system or anyone else). Install the body as that same user.    

> end;
>
>end;
>
>And it works, but in stead of image I've got
>it's hex code (you know, header GIF89 is 47494638396190...).
>
>Thanks.
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Tue Apr 27 1999 - 07:28:30 CDT

Original text of this message

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