0 Replies Latest reply: Dec 22, 2012 5:28 PM by 979843 RSS

    How to Display an Image on my FORM

      Good Day!
      I would like to ask some help from you guys with my problem on how to display an image on my form. I would like to display my uploaded image on my form but instead of an image, the get_blob_file is showing. By the way, I'm using Apex 4.1

      I downloaded the Order Entry Sample Application and followed the Page 6, the Product Details. I even made snapshots of each details from Page Rendering to Page Processing in order not to miss a thing.

      At the moment, I was able to upload or store the image on my created Oracle table and also able to retrieve it on the Download Link Text with Content Disposition value of Inline, provided by APEX Settings. If I invoke the Download link beside the file browser, a page with the image will be shown, below is the address:

      However, instead of showing the image on a region, below is the one showing on my Form:
      <img src="apex_util.get_blob_file?a=200&s=339877802936975&p=230&d=7107921433296839&i=7107601420296838&p_pk1=54&p_pk2=&p_ck=7D6512D967336C4B94258EEA3CDF1BE6" />

      As you can see the parameter values are the same but I know I missed something that's why I'm here :)

      I would highly appreciate all the help you can provide and many thanks in advance.

      I tried to change gear by making an html region of type PL/SQL (anonymous block) and a procedure but still no image :(

      Below are the scripts.

      cursor cur is
      select *
      from wsemployee
      where empid = :P230_EMPID;
      for rec in cur
      IF rec.mime_type is not null or rec.mime_type != '' THEN
      htp.p( '<img src="my_image_display?p_image_id='||NVL(rec.empid,0)||'" height="'||100||'"/>' );
      htp.p( 'No Image ');
      END IF;
      htp.p( ' ');
      end loop;

      create or replace PROCEDURE my_image_display( p_image_id IN NUMBER)

      l_mime VARCHAR2 (255);
      l_length NUMBER;
      l_file_name VARCHAR2 (2000);
      lob_loc BLOB;

      INTO l_mime,lob_loc,l_file_name,l_length
      FROM wsemployee
      WHERE empid = p_image_id;
      -- set up HTTP header
      -- use an NVL around the mime type and
      -- if it is a null set it to application/octect
      -- application/octect may launch a download window from windows
      owa_util.mime_header( nvl(l_mime,'application/octet'), FALSE );

      -- set the size so the browser knows how much to download
      htp.p('Content-length: ' || l_length);
      -- the filename will be used by the browser if the users does a save as
      htp.p('Content-Disposition: attachment; filename="'||replace(replace(substr(l_file_name,instr(l_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
      -- close the headers
      -- download the BLOB
      wpg_docload.download_file( Lob_loc );
      END my_image_display;

      Edited by: user13831927 on Dec 22, 2012 3:24 PM