Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to display images from BLOB column via APEX 4.0

661512Dec 13 2010 — edited Mar 28 2011
Hello,

I did the following in order to display images of two Oracle records on the APEX page. I am using APEX Version : 4.0.1.00.03 , Oracle DB Version : 10.2.0.4.0.

1. Created An oracle table TEST_FORM
with 3 columns
( ID number, MIME_TYPE varchar2(255) , Image BLOB )

2. Inserted two records

10001, image/gif, ( actual image1)
10002, image/gif, ( actual image2)

3. created an Oracle procedure

CREATE OR REPLACE PROCEDURE show_my_form ( p_image_id IN test_form.id%type) AS
l_mime test_form.mime_type%type;
l_length NUMBER;
l_file_name VARCHAR2 (2000);
lob_loc test_form.IMAGE%type;
BEGIN

SELECT mime_type, IMAGE
, DBMS_LOB.getlength (IMAGE)
INTO l_mime, lob_loc, l_length
FROM test_form
WHERE id = p_image_id;

owa_util.mime_header(l_mime, false);
htp.p ('Content-length: ' || l_length);
owa_util.http_header_close;
wpg_docload.download_file (lob_loc);

END show_my_form ;
/

4. In Apex 4.0

step1. Created an interactive report on a new APEX page
step2. Specified the following in the Region Source
select id, mime_type, '<img src="#OWNER#.show_my_form ?p_image_id=#ID#" />' photo
from TEST_FORM

The column result shows as <img src="CCS.show_my_form?p_image_id=#ID#" />

I am unable to display the column image as a link to a proper image photo.

Could you please advise me if I missed anything ?

Thanks a lot.

Regards
Susanna

Edited by: user10318332 on 13/12/2010 15:51

Edited by: user10318332 on 13/12/2010 20:10
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 25 2011
Added on Dec 13 2010
17 comments
7,643 views