This discussion is archived
3 Replies Latest reply: Mar 22, 2012 5:13 AM by 878672 RSS

Displaying an Image

878672 Newbie
Currently Being Moderated
Hi,
I am trying to display an image in a region on an APEX page, the image is a .PNG file which is contained in a BLOB column on the database. I have managed to do this by copying code from Page 6 in the Apex Demo application.
The problem I have is that everything I have tried needs an Automated Row Fetch process to display the image, without a ARF the image is just not displayed.
Now my final page needs to display an image from one table while allowing an update to another table. As you can't have TWO ARF in a single page I thougt it would be easy to use the ARF to control the update process and just select the image to be displayed without an ARF for it.

I have cretaed a page that has A File Browse item, an item for the primary key to the blob and a Display Image type. I have also created a Report to display the blob. In both cases as long as the ARF process exists the image is displayed in both places.

I am new to APEX and have totally failed in creating a page that will display an image without having a ARF :(

Can this be done ?

Any help would be greatly appreciated.
  • 1. Re: Displaying an Image
    Kiran Expert
    Currently Being Moderated
    Hello,

    Here is an example from Denes Kubicek's Blog:

    http://apex.oracle.com/pls/otn/f?p=31517:64:687291558805101::NO:::

    Please read the [url https://wikis.oracle.com/display/Forums/Forums+FAQ]FAQ and [url https://forums.oracle.com/forums/ann.jspa?annID=1324]forum instructions for more information on using OTN forums effectively.

    Please perform a [url https://forums.oracle.com/forums/search!default.jspa]forum search before posting a question as this will help reduce duplicate threads.

    Please update your forum profile with a real handle instead of user3272635.

    Hope it helps!
    Regards,
    Kiran
  • 2. Re: Displaying an Image
    Tom Petrus Expert
    Currently Being Moderated
    Hi,

    I also ran in some trouble with this some time ago. {message:id=3859537} in {thread:id=977177} has helped me a lot in understanding why this all happens. In short, apex_util.get_blob_file_src requires a file browse and ARP process. The easiest way to solve this is to create a page with just these 2 things on it, which i usually name something like 'photohack'. Then on the page you wish to get the blob on, simply refer to the file browse item on that page. Worked splendidly for me so far, and no creation of procedures and public synonyms necessary (which can be a pain to get in some cases...)
    For example, i have the process and file browse item on page 30. I want to display an image on page 10. i use <img src="apex_util.get_blob_file_src('P30_PHOTO_ITEM', <id>)", where <id> would be the primary key of your table holding the image blob!
  • 3. Re: Displaying an Image
    878672 Newbie
    Currently Being Moderated
    Hi Tom,

    Many thanks for this tip, it works a treat. I was using the example that Kiran had kindly pointed out but could not get it to work, the first problem I found was

    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "SYS.OWA_UTIL", line 356
    ORA-06512: at "SYS.HTP", line 1368
    ORA-06512: at "SYS.HTP", line 1443
    ORA-06512: at "SYS.OWA_UTIL", line 413
    ORA-06512: at "EIF.DISPLAY_IMAGE", line 18
    ORA-06512: at line 6

    I resolved this by searching around and found that you have to initialise the owa, so I added the following:

    nm owa.vc_arr;
    vl owa.vc_arr;

    BEGIN
    -- nm(1) := 'DUMMY_JUST_TO_SET_UP_OWA_UTIL';
    -- vl(1) := 'WHATEVER';
    -- owa.init_cgi_env( nm.count, nm, vl );

    Still I could not get the image to display, since I am using the Embeded Gateway I found the following:

    Image storage/retrieval

    This then lead me on to:

    http://docs.oracle.com/cd/B25329_01/doc/appdev.102/b25309/adm_wrkspc.htm

    I therrefore assumed that I also need to follow this and allow HTTP to run the procedure.

    Out of interest I would like to know if this is what I needed to do to get it to work however, I think I will use the trick of having the File Browse item on a different page.

    Many thanks for all your help.

    Regards
    Dave

    Edited by: user3272635 on Mar 22, 2012 12:13 PM

Legend

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