3 Replies Latest reply: Oct 13, 2012 1:28 AM by jariola RSS

    Displaying uploaded images in a report

    Johnny Be Good
      Hi there,

      I used to display images in a report successfully (in Oracle 10g and Apex Version prior to 4.1.1).
      Now I haved installed Oracle 11gR2 (64 bit) and Apex 4.1.1.00.23 and imported the application with the mentioned report,
      but the images are not displayed anymore.

      I am using the following code in the Html-Expression of a report column:
      <img title="#NAME#" src="#OWNER#.show_my_file?p_file=#PICTURE_ID#" width="40" height="40" />
      The procedure show_my_file looks like this:
      PROCEDURE SHOW_MY_FILE (p_file in number) as
              v_mime  VARCHAR2(48);
              v_length  NUMBER;
              v_file_name VARCHAR2(2000);
              Lob_loc  BLOB;
      BEGIN
              SELECT MIME_TYPE, PICTURE, Name,DBMS_LOB.GETLENGTH(PICTURE)
              INTO    v_mime,lob_loc,v_file_name,v_length
              FROM    PICTURES
              WHERE PICTURE_ID = p_file;
            
             owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
             htp.p('Content-length: ' || v_length);
             htp.p('Content-Disposition: attachment; filename="'|| v_file_name || '"');
             owa_util.http_header_close;
             wpg_docload.download_file( Lob_loc );
      
      end show_my_file;
      I granted execute on this procedure to public.

      But images are not being displayed anymore. I am a bit lost here.

      What am I missing here? I hope someone can point me in the right direction.

      Thank you.

      Regards
      Johnny

      P.S. Has something changed in from a previous version to Oracle 11gR2 or in apex 4.1.1 concerning this issue ??
        • 1. Re: Displaying uploaded images in a report
          jariola
          Hi,

          You might need change APEX schema function wwv_flow_epg_include_mod_local to allow your procedure.
          This might help to do so
          http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21678/adm_mg_service_set.htm#CIHIEECD


          Regards,
          Jari
          -----
          My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
          Twitter: http://www.twitter.com/jariolai
          • 2. Re: Displaying uploaded images in a report
            Johnny Be Good
            Thank you for the tip, Jari.

            This would have been a solution for Apex used with the built-in Gateway, right!?

            But I am using Apex 4.1.1 with the OHS (HTTP Server mit mod-plsql).

            Nevertheless, I modified the wwv_flow_epg_include_mod_local function in the Schema Apex_040100 and inserted the appropriate procedures,
            but still without success!

            Regards
            Johnny
            • 3. Re: Displaying uploaded images in a report
              jariola
              Hi,

              This is solution also for OHS if you have in dads.conf line
              PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize
              When you did modify function, did you also add schema qualifier ?
              Function should look like
              CREATE OR REPLACE FUNCTION
              wwv_flow_epg_include_mod_local(
                  PROCEDURE_NAME IN VARCHAR2)
              RETURN BOOLEAN
              IS  
              BEGIN  
                  IF UPPER(procedure_name) IN (
                        UPPER('your_schema.show_my_file')
                  ) THEN  
                      RETURN TRUE;  
                  ELSE  
                      RETURN FALSE;  
                  END IF;  
              END wwv_flow_epg_include_mod_local;
              Regards,
              Jari
              -----
              My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
              Twitter: http://www.twitter.com/jariolai