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: GIF image data and Oracle

Re: GIF image data and Oracle

From: Thomas kyte <tkyte_at_us.oracle.com>
Date: 1997/04/06
Message-ID: <3347cd41.5000900@newshost>#1/1

If an image is less then 32k in size, you can use pl/sql, otherwise you will have to goto C.

To do this with pl/sql you can:

>create or replace procedure image(img_id in varchar2)

    is

        theBlob long raw;

> begin
> select .... into theBlob .....
> htp.prn( utl_raw.cast_to_varchar2(theBlob) );
> end
>

btw: the utl_raw package is not installed by default. goto your $ORACLE_HOME/rdbms/admin directory and do an "ls *raw*" or "dir *raw*". You'll find the spec and body of this package. install them in svrmgrl or sqldba using connect internal or sys.

Alternatively, you can get the c code to do the above from http://govt.us.oracle.com/ under downloadable utilties from 'Quick Picks' on the home page. It has a pretty sizable image handling implementation (including uploading from a browser) and handles images of any size (given sufficient ram).

On 5 Apr 1997 03:59:18 GMT, "Brad Baker" <bradb_at_somerset.com.au> wrote:

>
>
>Daniel A. Morgan <dmorgan_at_exesolutions.com> wrote in article
><33447556.1D1_at_exesolutions.com>...
>> > We are developing a dynamic Web application using Oracle and we are
>> > writing out Web output using PL/SQL. We intend to store GIF images in
>> > the database as LONG RAW.
 

>> > My question is "How do I get image data into and out of Oracle?"
>> > We are running under Windows NT. What Oracle tools (and statements)
>> > can I use to insert a GIF file into a column?
>>
>> The only way I know, other than with a tool like Paradox For Windows, is
>> to write ProC.
>>
>> Daniel A. Morgan
>>
>
>Okay I have a handle on how we are going to get the images in the database.
> I used MS Access to intsert a GIF file for testing.
>
>My next question is how can I return these images in relation to Web
>browser request.
>
>I had planned to write a PL/SQL procedure that would return an image given
>an image id
>
> procedure image(img_id in varchar2)
> begin
> select ....
> htp.prn(row.image_blob);
> end
>
>And In my html write something like
>
> <img src="\us\owa\image?img_id=12345" ...>
>
>However with this approach I dont get any image coming back to the browser.
> Can I use the htp.prn() function to return pure image data?
>
>Note I wrote out the mime/header as "image/gif." before sending the reply.

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD

http://govt.us.oracle.com/ -- downloadable utilities



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Sun Apr 06 1997 - 00:00:00 CST

Original text of this message

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