1 2 Previous Next 17 Replies Latest reply: Nov 21, 2012 12:45 PM by Mehabub Sheikh Go to original post RSS
      • 15. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
        jariola
        Hi,

        Sorry, I did look your code too quickly.

        Regards,
        Jari
        -----
        My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
        Twitter: http://www.twitter.com/jariolai
        • 16. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
          Mehabub Sheikh
          I am able to resolve this problem. It seems that getting BLOB from WWV_FLOW_FILES does not work.
          Here is what I did
          create table XXAPPS_PRJ_FILES as select * from WWV_FLOW_FILES where 1=2
          I created a PL/SQL after validation and computation page process and did
          insert into xxapps_prj_files select * from WWV_FLOW_FILES where name =:P2_FILE_NAME
          Here P2_FILE_NAME is the File Browse Item based on WWV_FLOW_FILES.
          And I changed the procedure XXAPPS_IMG_DISPLAY accordingly
          create or replace PROCEDURE xxapps_img_display
          ( 
           p_img_id IN NUMBER
          )  
          AS  
                 
          l_mime       VARCHAR2 (255);  
          l_length     NUMBER;  
          l_file_name  VARCHAR2 (2000);  
          l_lob_loc    blob;  
          c_db_drec    CONSTANT  VARCHAR2(20) :='APEX_FILE_DIR';
          BEGIN  
             SELECT mime_type
                   ,filename
                   ,blob_content
                   ,DBMS_LOB.getlength (blob_content)
               INTO l_mime
                   ,l_file_name
                   ,l_lob_loc
                   ,l_length
               FROM xxapps_prj_files  
              WHERE id = p_img_id; 
              
             -- l_lob_loc  := bfilename('APEX_FILE_DIR', l_file_name);
             -- l_length   := dbms_lob.getlength(l_lob_loc);  
             OWA_UTIL.mime_header (NVL (l_mime, 'application/octet'), FALSE);  
             HTP.p('Content-length: ' || l_length);  
             --htp.p('Content-Disposition:  filename="' || SUBSTR(l_file_name, INSTR(l_file_name, '/') + 1) || '"');
             OWA_UTIL.http_header_close;  
             WPG_DOCLOAD.download_file (l_lob_loc);  
                
          END xxapps_img_display;  
          
          Now I want to check whether the will work for files stored under folder /tmp/apex/mehabub.
          But my issue is now with image size. Can I re-size my images?

          Thanks,
          Mehabub
          • 17. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
            Mehabub Sheikh
            I checked my procedure for files stored in file system and it is working fine now except the size of the image. I want uniform size.
            create or replace PROCEDURE xxapps_img_display
            ( 
             p_img_id IN NUMBER
            )  
            AS  
                   
            l_mime       VARCHAR2 (255);  
            l_length     NUMBER;  
            l_file_name  VARCHAR2 (2000);  
            l_lob_loc    bfile;  
            c_db_drec    CONSTANT  VARCHAR2(20) :='APEX_FILE_DIR';
            BEGIN  
               SELECT mime_type
                     ,filename
                 INTO l_mime
                     ,l_file_name
                 FROM xxapps_prj_files  
                WHERE id = p_img_id; 
                
                l_lob_loc  := bfilename('APEX_FILE_DIR', l_file_name);
                l_length   := dbms_lob.getlength(l_lob_loc);  
               OWA_UTIL.mime_header (NVL (l_mime, 'application/octet'), FALSE);  
               HTP.p('Content-length: ' || l_length);  
               --htp.p('Content-Disposition:  filename="' || SUBSTR(l_file_name, INSTR(l_file_name, '/') + 1) || '"');
               OWA_UTIL.http_header_close;  
               WPG_DOCLOAD.download_file (l_lob_loc);  
                  
            END xxapps_img_display; 
            Cheers,
            Mehabub
            1 2 Previous Next