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: GIFF and WebServer

Re: GIFF and WebServer

From: Dima Markman <dima_at_logal.co.il>
Date: 1996/12/17
Message-ID: <dima-1712961405210001@dima.logal.co.il>#1/1

In article <01bbe37c$f5465e20$5c581ba1_at_GOliveri.Infostrada.Olivetti.it>, "Giorgio Oliveri" <goliveri_at_mbox.vol.it> wrote:

> Dear Rajek.
>
> I have the problem You said in your message. If You or anybody will get
> some news please let me now about it.
>
> Thanks.
>
> Gulliver.
>
> Rajek <rajek_at_ITTI.EFP.Poznan.pl> wrote in article
> <32A72EF9.4292_at_ITTI.EFP.Poznan.pl>...
> > Hello!
> >
> > My software: WebServer 2.0, OracleWorkgroup Server 7.2 on NT.
> > How can I display Giff in my WWW-page direct from the database
> > field (LONG RAW).

You can try following package:

(see comments after source)

create or replace package web_giff is

   NL_CHAR constant char(1) := '
';

   TYPE row_image IS RECORD(

      length   varchar2(16),
      image    LONG

   );
   function get_row(name in varchar2) return row_image;    procedure dbimage2(name in varchar2); end;
/
show errors

create or replace 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 image_data 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(this.img); 
               ret.length := this.length;
               return ret;
       end;
        procedure dbimage2(name in varchar2) is
            this_raw       row_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);
                     htp.prn('Content-Length: ' || this_raw.length || NL_CHAR);
                     owa_util.http_header_close;
               
                     htp.prn(this_raw.image);
               end if;

        end;

end;
/
show errors
  1. you must create table image_data with img, name and length columnes. img is long raw type
  2. you must install owa_util, owa_raw, htp packages.
  3. you must install owa on your oracle web server (if you use non Oracle web server you need to create CGI application using OCI or other interface for access to DB) Bye, bye
Received on Tue Dec 17 1996 - 00:00:00 CST

Original text of this message

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