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: displaying Jpg BLOB in Web browser using PL/SQL

Re: displaying Jpg BLOB in Web browser using PL/SQL

From: Mike Ault <mikerault_at_earthlink.net>
Date: 18 Jun 2002 05:00:13 -0700
Message-ID: <37fab3ab.0206180400.205d82db@posting.google.com>


Benoit,

I am not really familiar with the owa package. However, this might be better done with an external procedure in JAVA. I have a very simple example of a JAVA applet that does this that could be converted to an external call. Look in the Yahoo group Lazyscripts.

Mike Ault
Benoit Hebert <bhebert_at_borabora.crchul.ulaval.ca> wrote in message news:<3D0E4C1A.15FA06_at_borabora.crchul.ulaval.ca>...
> Hi folks.
>
> We've loaded a JPG image into a Blob in our database, and we want to
> retrieve it, and display it in the user's Web browser, using a PL/SQL
> procedure. We've used Tom Kyte's image_get procedure, and changed the
> mime header for JPEG files. However, the procedure doesn't work - we get
> a broken image link as a result.
>
> We know the image was loaded correctly into the database. A Perl script
> can fetch it, and we've confirmed through visual inspection and through
> a checksum that the image is the same as the original. I tried
> right-clicking the broken image link and saving it as a local file, and
> the image is corrupted.
>
> Here is the image_get package body:
>
> CREATE OR REPLACE package body insitu.image_get
> AS
>
> procedure jpg (p_id in images.no_image%type)
> AS
> s_image blob;
> l_amt number default 30;
> l_off number default 1;
> l_raw raw(4096);
>
> BEGIN
>
> SELECT fichier_image INTO s_image FROM images WHERE no_image = p_id;
>
> owa_util.mime_header( 'image/jpeg' );
>
> begin
> LOOP
> dbms_lob.read(s_image, l_amt, l_off, l_raw);
> htp.prn( utl_raw.cast_to_varchar2( l_raw ));
> l_off := l_off + l_amt;
> l_amt := 4096;
> END LOOP;
>
> EXCEPTION
> when no_data_found then
> NULL;
>
> end;
> end;
> end;
> /
>
> The procedure is called in another PL/SQL procedure, that displays the
> complementary information.
>
> htp.print(' <TD ALIGN="Center" COLSPAN-"4"><IMG
> SRC="/pls/invivo/insitu.image_get.jpg?p_id=' || pNo_Image || '"></TD>');
>
>
>
> We're thinking that this might be a mime problem, but we can't quite
> figure it out. Does anybody have any ideas that might help?
>
> Thanks a lot!
Received on Tue Jun 18 2002 - 07:00:13 CDT

Original text of this message

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