Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: OWS: how to retrive image from db?
A copy of this was sent to tkyte_at_us.oracle.com (Thomas Kyte)
(if that email address didn't require changing)
On Tue, 27 Apr 1999 12:28:30 GMT, you wrote:
>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);
forgot to mention, you'll need to put:
owa_util.mime_header( 'image/gif' );
here to get the mime type setup as well...
>
> 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
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA
--
http://govt.us.oracle.com/ -- downloadable utilities
![]() |
![]() |