Re: GIF images, Oracle WS and images
From: <meier_at_pegas.com>
Date: 1997/04/23
Message-ID: <861802100.7127_at_dejanews.com>#1/1
'/meier/owa/web_giff.dbjpg?name=vs104.jpg','vs104')); htp.htmlClose; exception when others then htp.p(sqlerrm); end; end;
Date: 1997/04/23
Message-ID: <861802100.7127_at_dejanews.com>#1/1
> > My question is how can I return these images in relation to Web browser
> > Is there another way to do this? (I know I could put the images on the
i use the following PL/SQL Package to do this
package web_giff is NL_CHAR constant char(1) := ' '; TYPE row_image IS RECORD( length varchar2(20), image LONG ); function get_row(name in varchar2) return row_image; procedure dbgif(name in varchar2);procedure dbjpg(name in varchar2); procedure test; end; package body web_giff is
--********************************************************************function get_row(name in varchar2) return row_image is
--********************************************************************* ret row_image; cursor c (this_name varchar2) is select * from mei_giff the where the.name = this_name; this c%ROWTYPE; begin open c (name);fetch c into this; if c%notfound then ret.image := NULL; ret.length := 0; return ret; end if; close c; ret.image := utl_raw.cast_to_varchar2(utl_raw.substr(this.image,1)); ret.length := this.length; return ret; exception when others then dbms_output.put_line(sqlerrm); return ret; end;
--*************************************************** proceduredbgif(name in varchar2) is
--****************************************************** this_rawrow_image; begin this_raw := get_row(name); if this_raw.length = 0
then owa_util.status_line(404,'Not Found'); else -- owa_util.mime_header('image/gif',FALSE); owa_util.mime_header('image/gif'); -- htp.prn('Content-Length: ' ||this_raw.length || NL_CHAR); -- owa_util.http_header_close; htp.prn(this_raw.image); end if; end;
--************************************************** proceduredbjpg(name in varchar2) is
--************************************************** this_rawrow_image; begin this_raw := get_row(name); if this_raw.length = 0 then owa_util.status_line(404,'Not Found'); else --
owa_util.mime_header('image/jpg',FALSE); owa_util.mime_header('image/jpeg'); -- htp.prn('Content-Length: ' || this_raw.length || NL_CHAR); -- owa_util.http_header_close;htp.prn(this_raw.image); end if; exception when others then
htp.p(sqlerrm); end; --*********************************************** procedure test is --************************************************begin htp.htmlOpen; htp.tableOpen; htp.tableRowOpen; htp.TableData(htf.anchor(
'/meier/owa/web_giff.dbjpg?name=vs104.jpg','vs104')); htp.htmlClose; exception when others then htp.p(sqlerrm); end; end;
The table is use has the following structure
create table mei_giff (
name varchar2(20),
image long raw,
length number);
Additional you must have installed the UTL_RAW Package on your Oracle Server.
That works!
-------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to UsenetReceived on Wed Apr 23 1997 - 00:00:00 CEST