This discussion is archived
1 2 Previous Next 17 Replies Latest reply: Nov 21, 2012 10:45 AM by Mehabub Sheikh RSS

Show Images from file system APEX 4.2 11GXE on Centos5 with EPG

Mehabub Sheikh Journeyer
Currently Being Moderated
Hi,

I created a database directory CREATE DIRECTORY APEX_FILE_DIR AS '/tmp/apex/mehabub/'
and then chnaged the owner to oracle id with which my DB has been installed.
Then
I have created page to upload the images to file system and download them from there as per this
https://kr.forums.oracle.com/forums/thread.jspa?threadID=634578

Now what I want is to display the images on the page itself. This should get the file from the file system and display it.
Once that is done I need to get the image slider which will display all the images which are there under that folder.

Could you please help?

Thanks,
Mehabub
  • 1. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
    Prabodh Guru
    Currently Being Moderated
    Mehabub,
    I created a database directory CREATE DIRECTORY APEX_FILE_DIR AS '/tmp/apex/mehabub/'
    and then chnaged the owner to oracle id with which my DB has been installed.
    Then
    I have created page to upload the images to file system and download them from there as per this
    https://kr.forums.oracle.com/forums/thread.jspa?threadID=634578

    Now what I want is to display the images on the page itself. This should get the file from the file system and display it.
    Once that is done I need to get the image slider which will display all the images which are there under that folder.

    Could you please help?
    >

    The issue here is that you cannot get the list of files in a directory in PL/SQL. See this thread for more details http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:439619916584

    Once you get the list of files, using a technique similar to the one in the above link, it is only a simple matter of iterating to display all the files in the list.

    Cheers,
  • 2. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
    Mehabub Sheikh Journeyer
    Currently Being Moderated
    Hi Prabodh,

    Thank you very much for the information.
    Actually when I am uploading the files I am doing as follows
    1) Upload file with Files Browse Item type based on WWV_FLOW_FILES
    2) Get the BLOB from WWV_FLOW_FILES and store in the directory and store file ID and name in a custom table and then delete the blob from WWV_FLOW_FILES

    So here I know the image file names from the custom table. Now what I want is to display the image through Imgae Slider.
    I checked that the image slider uses BLOB content stored in the tables. So I can not use that. Here I will get the images from the directory and display them one by one.

    Could you please provide further details about how to do that?

    Thanks,
    Mehabub
  • 3. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
    fac586 Guru
    Currently Being Moderated
    Mehabub Sheikh wrote:

    I checked that the image slider uses BLOB content stored in the tables. So I can not use that.
    Why not? Images in the database are accessed through URIs in the same way as images located in any other location.

    What "image slider"? What APEX version?
  • 4. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
    Prabodh Guru
    Currently Being Moderated
    Mehabub,
    Actually when I am uploading the files I am doing as follows
    1) Upload file with Files Browse Item type based on WWV_FLOW_FILES
    2) Get the BLOB from WWV_FLOW_FILES and store in the directory and store file ID and name in a custom table and then delete the blob from WWV_FLOW_FILES

    So here I know the image file names from the custom table. Now what I want is to display the image through Imgae Slider.
    >
    Which image slider? The jQuery Mobile Slider item (HTML5)?
    >
    I checked that the image slider uses BLOB content stored in the tables. So I can not use that. Here I will get the images from the directory and display them one by one.

    Could you please provide further details about how to do that?>
    If know you can fetch the images from BLOB column then you could simply reverse the process. Load the file into a BLOB column in a temp table and use it. You could consider Global Temporary Table for the purpose. That way you do not have to manage the rows in that table.

    Cheers,
  • 5. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
    Mehabub Sheikh Journeyer
    Currently Being Moderated
    Hi Fac,

    Thank you for the information.
    My Apex version is 4.2with EPG on CentOS 5 and my images are there under file system /tmp/apex/mehabub.
    Could you please tell me how to get them displayed?
    I am learning APEX so I might be asking some very basic questions. Please bear with me.

    Thanks,
    Mehabub
  • 6. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
    fac586 Guru
    Currently Being Moderated
    Mehabub Sheikh wrote:
    .
    My Apex version is 4.2with EPG on CentOS 5 and my images are there under file system /tmp/apex/mehabub.
    Could you please tell me how to get them displayed?
    No I can't. And nor can anyone else until you provide full details of this mysterious "image slider" and why you think it can't access images from the database.
  • 7. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
    Mehabub Sheikh Journeyer
    Currently Being Moderated
    Hi Fac,

    Sorry for the confusion. Actually I want my images to be displayed through some thing like image slider.
    I checked one such plug in but could not make out what it does.
    So basically I want my images to be displayed through image slider.
    My question is
    1) Is there any such image slider plug in which I can use to display my images which are there under /tmp/oracle/mehabub folder?.

    I know the image file names as they are stored in my custom table (id,filname)?

    Thanks for your patience.

    Mehabub
  • 8. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
    fac586 Guru
    Currently Being Moderated
    Mehabub Sheikh wrote:
    Hi Fac,

    Sorry for the confusion. Actually I want my images to be displayed through some thing like image slider.
    I checked one such plug in but could not make out what it does.
    So basically I want my images to be displayed through image slider.
    My question is
    1) Is there any such image slider plug in which I can use to display my images which are there under /tmp/oracle/mehabub folder?.
    This is going round in circles. You said initially that the images have to be in the file system rather than the database because this is required by the "image slider":
    I checked that the image slider uses BLOB content stored in the tables. So I can not use that. Here I will get the images from the directory and display them one by one.
    Now you say:
    Actually I want my images to be displayed through some thing like image slider.
    Implying that you don't have an "image slider", and therefore that the requirement to have the images in the file system is moot.

    Start with the basics: what is this "image slider"?
  • 9. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
    Mehabub Sheikh Journeyer
    Currently Being Moderated
    Sorry Fac, it seems you are in different mood today :-)
    I said my images are there under /tmp/apex/mehabub.
    I store the file id and file name in a custom table not the file itself as a blob. I store the file in file system.
    I want my images to be displayed through an image slider where in images are displayed in sequence with a time lag.
    I checked one image slider plug in and again I said I don't know how id does.

    I am asking for help to display my images which are stored in my file system through image slider like http://www.apex-at-work.com/2012/01/image-slider-plugin.html

    Anyway thank you for your patience.

    Mehabub
  • 10. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
    Mehabub Sheikh Journeyer
    Currently Being Moderated
    Hi Fac and Prabodh,

    As per the link http://www.apex-at-work.com/2012/01/slider-plug-in-with-images-from-table.html
    I have created following procedureXXAPPS_IMG_DISPLAY in my current schema using the table approach
    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 wwv_flow_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);  
       OWA_UTIL.http_header_close;  
       WPG_DOCLOAD.download_file (l_lob_loc);  
          
    END xxapps_img_display;  
    In the plug in region source I have entered the following query
    select  
    ID as id,  
    '#OWNER#.xxapps_img_display?p_img_id=' ||ID as img,  
    FILENAME as text,  
    DESCRIPTION as description,  
    'bottom' as position  
    from wwv_flow_files
    I have also done
    connect sys as sysdba
     
    --grant all users the ability to execute this procedure. jeet is my schema
    GRANT EXECUTE ON jeet.xxapps_img_display TO PUBLIC;
     
    --create synonym
    CREATE PUBLIC SYNONYM xxapps_img_display FOR jeet.xxapps_img_display;
    Then I added my procedure XXAPPS_IMG_DISPLAY in wwv_flow_epg_include_mod_local function.
    After doing all these still the images are not displayed. One small box is appearing in stead of the image.

    Please help me.

    Thanks,
    Mehabub

    Edited by: Mehabub Sheikh on Nov 21, 2012 7:46 AM
  • 11. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
    jariola Guru
    Currently Being Moderated
    Hi,

    You need grant read privilege on directory to DAD user. I assume you use EPG
    grant read on directory APEX_FILE_DIR to anonymous;
    And your app parsing schema
    grant read on directory APEX_FILE_DIR to jeet;
    This my blog post might also help
    http://dbswh.webhop.net/htmldb/f?p=BLOG:READ:0::::ARTICLE:91800346957167

    Regards,
    Jari
    -----
    My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai
  • 12. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
    Mehabub Sheikh Journeyer
    Currently Being Moderated
    Hi Jari,

    I have done all these. I am able to download the images but not able to show the image.

    Any idea why?

    Thanks,
    Mehabub
  • 13. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
    jariola Guru
    Currently Being Moderated
    Hi,

    Could problem be wrong mime type you set in procedure?
    OWA_UTIL.mime_header (NVL (l_mime, 'application/octet'), FALSE);  
    Regards,
    Jari
    -----
    My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai
  • 14. Re: Show Images from file system APEX 4.2 11GXE on Centos5 with EPG
    Mehabub Sheikh Journeyer
    Currently Being Moderated
    Hi Jari,

    The mime type 'image/jpeg'. Is it invalid?

    Thanks,
    Mehabub
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points