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 -> Images in Oracle 8.0.5

Images in Oracle 8.0.5

From: primz <primz_at_bigpond.com>
Date: Tue, 18 Jan 2000 14:40:31 +1100
Message-ID: <3883E0AF.8E5759D1@bigpond.com>

    Hi Everyone,

            I was just going through the discussion group messages, and the one reproduced below,
interests me because I am having a similar problem, for quite a while now.

The solution Chris suggested works fine with BLOB data. But we have OAS 4.0.7/Oracle
8.0.5 combination and it uploads the images directly in the OWS_CONTENT table
owned by user WEBSYS. The problem is that the image itself is stored in LONG RAW
format, so how do one work with data more than 32K.

           Is there a way of changing the schema where OAS uploads the images, or
converting the raw data to blob without writing external procedures?

We have been stuck on this for quite a while now. One of the guys( from a different
discussion group) suggested that we should use OWA replacement cartridge. The
problem with this is, that it is too complicated to install/configure it.

         So, I was wondering if there is any other way of doing this?

Thanks in advance for any help.

Regards
--Nick

On Thu, 13 Jan 2000 14:39:47 GMT, vervecken_at_my-deja.com wrote:

>I'm currently building a database that contains images. These images
are
>stored as BLOB's.
>The database is to be accessed by a PL-SQL cartridge that will allow
the
>user to see the images on a browser.
>
>My questions:
>
>Is it possible to this command: htp.img('directory/nameofpicture'), but

>instead of hardcoding the name and location of the image, using a
>variable that refers to the BLOB?
>The image itself is an actual part of the database. It does not exist
as
>a seperate file on the disk.

Sure is. You will want to write a procedure that prints the blob given some data that tell it what blob you want. You will also need the mimetype
of the image. Here is an example.

given...

create table images(
  id number primary key,
  mimetype varchar2(2000),
  image blob )
/

you can use the procedure...

create or replace
procedure get_image( p_id number ) as

    l_raw raw(4069);
    l_amt number default 4000;
    l_off number default 1;

begin
  for c in ( select *
               from images
              where id = p_id )

  loop
    dbms_lob.open( c.image, dbms_lob.lob_readonly );     owa_util.mime_header( c.mimetype );     begin
      loop
        dbms_lob.read( c.image, l_amt, l_off, l_raw );
        htp.prn( utl_raw.cast_to_varchar2( l_raw ) );
        l_off := l_off+l_amt;
        l_amt := 4000;
      end loop;
    exception
      when no_data_found then
        null;

    end;
  end loop;
end get_image;
/

and you would call it like this...

procedure show_image_on_web_page is
  l_id number := 123;
begin
  htp.img( 'procedure_owner.get_image?p_id=' || l_id ); end show_image_on_web_page;
/ Received on Mon Jan 17 2000 - 21:40:31 CST

Original text of this message

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