Hi,
I have looked up quite a few forum posts on getting an image stored in a blob column to display in plsql report. I tried all of them with no success. I am using Oracle APEX 4.0.1 with 11g. My procedure is as below:
CREATE OR REPLACE procedure display_image(testID in varchar2) as
v_mime varchar2(255);
v_length number;
v_file_name varchar2(2000);
Lob_loc BLOB;
BEGIN
select document_mime, document_image, document_filename,dbms_lob.getlength(document_image)
into v_mime,lob_loc,v_file_name,v_length
from table_name
where test_id = testID and flag is null;
-- application/octect may launch a download window from windows
owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
-- set the size so the browser knows how much to download
htp.p('Content-length: ' || v_length);
-- the filename will be used by the browser if the users does a save as
htp.p('Content-Disposition: attachment; filename="' || v_file_name || '"');
-- close the headers
owa_util.http_header_close;
-- download the BLOB
wpg_docload.download_file( Lob_loc );
end display_image;
In the plsql report, I use
htp.img('#OWNER#.display_image?testID='||:P5_TEST_ID); //page item that has the test ID
I have granted execute to both public and anonymous, still no change. When I run, I see a broken image in the report, on checking with inspect element, the url looks fine: http://server/pls/apex/display_image?testID=d6252.
Am I missing something? Any help is much appreciated!
Thanks,
Medha