How to change image in APEX
lxiscasJul 3 2012 — edited Oct 1 2012Hi, Guys:
I am struggling to display multiple images one page by clicking button. I implement an PL/SQL stored procedure as follows:
CREATE OR REPLACE PROCEDURE Sor_Display_Current_Image(p_n_Offender_id IN NUMBER, p_n_image_Count in number) AS
v_mime_type VARCHAR2(48);
v_length NUMBER;
v_name VARCHAR2(2000);
v_image BLOB;
v_counter number:=0;
cursor cur_All_Images_of_Offender is
SELECT 'IMAGE/JPEG' mime_type, dbms_lob.getlength(image) as image_length, image
FROM sor_image
WHERE offender_id = p_n_Offender_id;
rec_Image_of_Offender cur_All_Images_of_Offender%ROWTYPE;
BEGIN
open cur_All_Images_of_Offender;
loop
fetch cur_All_Images_of_Offender into rec_Image_of_Offender;
v_counter:=v_counter+1;
if (v_counter=p_n_image_Count) then
owa_util.mime_header(nvl(rec_Image_of_Offender.mime_type, 'application/octet'), FALSE);
htp.p('Content-length: '||rec_Image_of_Offender.image_length);
owa_util.http_header_close;
wpg_docload.download_file (rec_Image_of_Offender.image);
end if;
exit when ((cur_All_Images_of_Offender%NOTFOUND) or (v_counter>=p_n_image_Count));
end loop;
close cur_All_Images_of_Offender;
END Sor_Display_Current_Image;
###############
and I set up a report region in the page with such a query:
select max(OFFENDER_ID) OFFENDER_ID, 'PHOTO' from sor_image where offender_id = 1
there are many offenders, but i just try 1.
#########################
and I set up the column of photo as
<img src="#OWNER#.SOR_DISPLAY_IMAGE?P_N_OFFENDER_ID=#OFFENDER_ID#, p_n_image_Count=2" width="75" height="75">
Here I just tried to display the second image of this guy.
I cannot display image in report, Could anyone give me an example about it?
Thanks a lot!
Edited by: lxiscas on Jul 3, 2012 2:45 PM