Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Displaying images from PL/SQL cartridge
This is driving me nuts and I'm sure it's caused by something stupid I'm
missing. I have jpeg images stored in BLOB columns in an 8i database.
I want to write a plsql procedure (used as a OAS 4.0.7 cartridge) that
returns an image to the browser. Here's a sample of the code:
procedure display(p_image_id in number) is
lob_loc BLOB;
buffer RAW(32767);
amount BINARY_INTEGER := 32767;
position INTEGER := 1;
total_size INTEGER := 0;
begin
select asset_content into lob_loc from asset_blob where asset_blob_id = p_image_id;
loop
dbms_lob.read (lob_loc, amount, position, buffer);
total_size := total_size + amount;
htp.prn(buffer);
position := position + amount;
end loop;
exception when others then
dbms_lob.close(lob_loc);
end;
When I call this thing from the browser I get a broken image display. If I view the source, I see an ascii representation of the image contents, e.g.:
FFD8FFE000104A46494600010100000100010000FFDB0084... and so on...
All of the data is there; it just isn't being interpreted as an image. Any suggestions or insites would be most appreciated.
Thanks,
Tom Barry
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Oct 19 1999 - 09:22:55 CDT