Display image in report page but just a link if file is not an image

Hello,
I've been working on displaying an image in a report page but need to add some logic.
I would like to be able to call the image using a Region Source of type SQL instead of the HTML Expression. The reason for this is because I need to use logic to determine if the file is an image or not and to determine wether to show a thumbnail or just a link. I did find a "GET_BLOB_FILE_SRC" Function on the internet that suggests that I could do this but I need some help in making it work in my application.
Here it is as a Region Source of type SQL:
SELECT ID,
NAME,
CASE WHEN NVL(dbms_lob.getlength(document),0) = 0
THEN NULL
ELSE CASE WHEN attach_mimetype like 'image%'
THEN '<img
src="'||apex_util.get_blob_file_src('P4_DOCUMENT',id)||'" />'
ELSE '<a
href="'||apex_util.get_blob_file_src('P4_DOCUMENT',id)||'">Download</a>'
end
END new_img
FROM TEST_WITH_BLOB
If anyone can help me with this that would be appreciated.
Thanks
LEH

John,
The problem is that I do not know how to use the "GET_BLOB_FILE_SRC Function". I never got it to work but the HTML Expression did work for me. If you know how the GET_BLOB_FILE_SRC Function works then that would be helpful. I don't think it would be helpful if I posted my example on apex.oracle.com. But here is the information I have on the GET_BLOB_FILE_SRC Function.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
GET_BLOB_FILE_SRC Function
As an alternative to using the built-in methods of providing a download link, you can use the APEX_UTIL.GET_BLOB_FILE_SRC function. One advantage of this approach, is the ability to more specifically format the display of the image (with height and width tags). Please note that this approach is only valid if called from a valid Oracle Application Express session. Also, this method requires that the parameters that describe the BLOB to be listed as the format of a valid item within the application. That item is then referenced by the function.
See Also:
"About BLOB Support in Forms and Reports" in Oracle Application Express Application Builder User's Guide
Syntax
FUNCTION GET_BLOB_FILE_SRC (
    p_item_name           IN VARCHAR2 DEFAULT NULL,
    p_v1                  IN VARCHAR2 DEFAULT NULL,
    p_v2                  IN VARCHAR2 DEFAULT NULL,
    p_content_disposition IN VARCHAR2 DEFAULT NULL)
    RETURN VARCHAR2
Parameters
Table 1-28 describes the parameters available in GET_BLOB_FILE_SRC function.
Table 1-28 GET_BLOB_FILE_SRC Parameters
Parameter Description
p_item_name
Name of valid application page ITEM that with type FILE that contains the source type of DB column.
p_v1
Value of primary key column 1.
p_v2
Value of primary key column 2.
p_content_disposition
Specify inline or attachment, all other values ignored
Example
As a PLSQL Function Body:
RETURN '<img src="'||APEX_UTIL.GET_BLOB_FILE_SRC('P2_ATTACHMENT',:P2_EMPNO)||'" />';
As a Region Source of type SQL:
SELECT ID,
       NAME,
       CASE WHEN NVL(dbms_lob.getlength(document),0) = 0
            THEN NULL
            ELSE CASE WHEN attach_mimetype like 'image%'
                      THEN '<img
src="'||apex_util.get_blob_file_src('P4_DOCUMENT',id)||'" />'
                      ELSE '<a
href="'||apex_util.get_blob_file_src('P4_DOCUMENT',id)||'">Download</a>'
                      end
        END new_img
   FROM TEST_WITH_BLOB
The previous example illustrates how to display the BLOB within the report, if it can be displayed, and provide a download link, if it cannot be displayed.Thanks
LEH

Similar Messages

  • How to stop to display the main report page header in the subreport!

    Hello all,
    I have an existed report that display the CR page header on every page of the report. Now I added another subreport into report footer without using link. How do I stop to display the main report page header and display the subreport in the new page with subreport header only? I really appreciate your time to help me out on this issue. Thanks.

    Hi,
    I tried to supress the page header with (onlastrecord and TotalpageCount > 1) condition, but the last page of main report without page header. I still like the page header display on last record, but not on the subreport only. How do I get it? Thanks in advance.

  • How can I move a title longer than the screen, no the page but just the title in FCP X?

    How can I move a title longer than the screen, not the page but just the title in FCP X?

    Select the title clip in the Timeline, Then Transform. Either click and drag or use the Inspector Position parameters to adjust.
    Russ

  • I just burned to disc an album of photos I created in Pages but I cannot open the file on the disc because "the format is not valid".  What does this mean and how do I correct it ?

    I just burned to disc an album of photos I created in Pages but I cannot open the file on the disc because "the format is not valid".  What does this mean and how do I correct it ?

    There are numerous thread about the same matter in this forum
    I hope you'll find your answer
    https://discussions.apple.com/search.jspa?resultTypes=&dateRange=all&peopleEnabl ed=true&q=the+format+is+not+valid&containerType=14&container=2084&username=&rank By=relevance&numResults=15

  • Restrict Form & Reports Pages but allow users to Save their Records

    Hi
    I have a database with Forms & editable Reports pages.
    I have also created a table with certain 'Admin Levels' of access so that users with the 'ADMIN_LEVEL' = 1 cannot access the editable reports pages.
    I find that applying the below restriction stops those users from accessing the reports but also won't allow those users to save any records.
    select USER_ID
    from USERS
    where USER_ID=:APP_USER
    and ADMIN_LEVEL > 1
    I then thought I could create a new page of the report but make it uneditable & use the 'Create' button to save the record to the table, but this doesn't work.
    My question is, how can I restrict access to a reports page but still allow records from restricted users to be saved?
    Thanks

    Hi,
    Firstly, you should look into Authorization Schemes: [http://download.oracle.com/docs/cd/E14373_01/appdev.32/e11838/sec.htm#BABCAGAB]
    I would suggest you create a scheme to identify admin users called, say, ADMIN_USER. This could be an EXISTS SQL query scheme of something like:
    SELECT 1
    FROM USERS
    WHERE UPPER(USER_ID) = UPPER(v('APP_USER'))
    AND ADMIN_LEVEL = 1Then, on any item within your application, you have an Authorization Scheme setting. You can then set this to either "ADMIN_USER" or "{not}ADMIN_USER" to determine which user can have access to that item. "{not}ADMIN_USER" is any user where the above query would return no records.
    Using this, you could grant access to a page, but stop access to a button and/or process. You don't, for example, have to set a scheme for the page itself (you can leave the setting as "- No Authorization Required -", so everyone can get to the page), but you can then set a Scheme for a button on that page. If the user is an ADMIN_USER and you have set a button for {not}ADMIN_USER, that user won't get the button on the page (you should also make the same setting on any process that this button triggers).
    But, if you set the page's Scheme to {not}ADMIN_USER, any ADMIN_USER will not even be able to get to the page.
    Andy

  • I have just upgraded to Lightroom 5 and my pictures that were from an later version came over but read on each picture "File can not be found"

    I have just upgraded to Lightroom 5 and my pictures that were from an later version came over but read on each picture "File can not be found"

    This screenshot shows which previous versions of iPhoto are compatible with Mavericks.  It also indicates which versions qualify for a free upgradeto iPhoto 9.5.1 and which require a purchase:
    Note 1:  every day more users are reporting problems with iPhoto 8.1.2 so I've included it in the non compatible category.
    Note 2:  If your previous version of iPhoto was iPhoto 7 (08) or earlier you'll need to download and run the iPhoto Library Upgrader 1.1 application on the library before opening it with iPhoto 9.5.1

  • Nikon Df RAW (NEF) files will not load previews into Lightroom 5.4. Nikon d300s RAW (NEF) files load just fine. Df files do not.

    Nikon Df RAW (NEF) files will not load previews into Lightroom 5.4. Nikon d300s RAW (NEF) files load just fine. Df files do not.

    Thank you for your response.
    I have loaded directly into Lightroom using import and via Nikon Capture NX2. RAW files display fine in Capture.
    In Lightroom, blank previews are created for each available image, with the message "Preview unavailable for this file."

  • How to display data in report page footer ?

    Hi friends, we have heading popup defined in PLUS. but I don't know hw I can place information in the footer part of the report page.

    Hello Sabine, Hello Vignesh,
    I have also started working in discoverer. The version is 9.0.4
    I cannot find the Menu File --> Page Settings option neither in Discoverer Administrator nor in Discoverer Plus. Will you pls tell hw I can get them.
    I have to implement Date of creation as well as page "m of n" functionality in the reports' footer.

  • Why when i upload pics i can't see them  on my fb home page but just on ios album??

    Who can help me!?

    im having the same problem! it just started 2 days ago and im frustrated! Tech support sez its a FB issue not an apple software issue....i left a message on FB help page, but that will fall on deaf ears. i am bound and determined to find out what the deal is!

  • The image for my podcast is displaying in Itunes preview pages, but does not display when I subscribe

    So the image arwork is appearing here:
    http://itunes.apple.com/au/podcast/wa-families-of-the-future/id538653708
    However after I have subscribed, the artwork for this one doesn't come up in my iTunes podcast folder. The related RSS feed for this link is:
    http://feed.viostream.com/891c439f-75f2-47aa-93d9-22508893b5bb

    While the image which appears in the Store page is referenced in the feed, the image which appears when you select a downloaded episode after subscribing is not: it has to be actually embedded in each episode's media file. Please see this page for a full explanation:
    http://www.wilmut.webspace.virginmedia.com/notes/coverart.html

  • Mounting my 23" display portrait-style...but just temporarily?

    I'm going to be working on a project to create several posters. These posters are portrait-orientation, so to facilitate working that way, I'd like to turn my 23" monitor on its side. I know there are expensive monitor arms that allow me to do this, but since I only want to do this for a couple of months, I'm wondering if anyone out there has figured out a way to position the monitor securely in this fashion relatively inexpensively.
    Thanks.

    I have heard of this type of stand being used when the leg breaks off the back of an Apple display. If there is a local music store, see if they have a stand of the right size. If the display is the older plastic case, with ventilation slots at the top and bottom, don't run at high brightness when rotated, as it may overheat.

  • FF4 has lost my personalised igoogle homepage ( it just defaults to the bog standard igoogle page), i have tried to reset it using tools- options- general- Use Current Page , but this still doesn't work, why not ?

    The problem also seems to be connected to the errors of "keep me signed in" and "Log me on automatically each visit" not functioning. As my computer is a home computer and i am the only user, i was wondering if anyone out there has any solutions ?

    Such details are stored in a cookie. If you want to prevent Google from redirecting you then you need to make an allow exception to keep that Google cookie.
    Tools > Options > Privacy > Cookies: Exceptions
    Also make sure that you do not use [[Clear Recent History]] to clear the "Cookies" and the "Site Preferences"

  • I am making a montage and I am trying to make the photos do the effect where they slightly move either to the sides or up and down while they are being shown. Not a transition but just something so that they are not all stagnant on screen. Any ideas?

    I know on Windows Movie Maker it automatically adds these glide effects to your montage, but it seems very complicated to do in FCP X. I downloaded Fx Factory but that seems difficult as well. This really shouldn't be very hard. Thank you so much and I look forward to getting some insight on this.

    do a search on fcpx "ken burns". It's built into FCPx but you can also do your own, manually. first, explore the ken burns effect.

  • HT6114 Can't save downloads to existing files??  In the "save as" box I use the little "search" window to locate where I want to put a new file but when found the location file does not operate.  And dropdown menu says "save to online acct"

    When I try to save an emailed-to-me document to an existing file on my hard drive by using the little "search" window the recipient file is inactive and does not open to recieve the document I want to save (nothing happens when I click on it and it's a subdued color).
    If I click through my files manually by starting on the desktop and working my way to the location of the recipient file I can save.
    This takes a lot of time and is DRIVING ME CRAZY!
    Please tell me I've just missed something obvious that can be fixed in a jiffy!?

    OMG!!  It also happens when I try to open a file from inside a program like Adobe Reader.  If I use the little corner search window all the files are inoperable.

  • When accessing some pages, it starts to download .part file and not showing the page

    When I access http://ingig.net it starts to download a .part file and doesn't show the page. I can view it the standard browser on Android 2.3
    The Response Header is
    Cache-Control:no-cache
    Content-Encoding:gzip
    Content-Length:8760
    Content-Type:text/html; charset=utf-8
    Date:Thu, 07 Jul 2011 13:52:28 GMT
    Expires:-1
    Pragma:no-cache
    ServerId:FROMSWEB02
    Set-Cookie:ASP.NET_SessionId=ax3mgqrhwyj41lszbjsi1lka; path=/; HttpOnly
    ntCoent-Length:27669

    The page uses a non-standard mime type application/vnd.wap.xhtml+xml. Firefox is not a wap browser.

Maybe you are looking for

  • ISupplier PO Notification

    Hi, We use iSupplier and iProc module. We have a requirement to notify the external supplier (in mail along with PO report output) when a PO is approved or revised. Assume that I have configured my workflow mailer. One probable way to achieve this is

  • I Can't Burn A Usable MP3 CD On My Mac /10.7.5 / Lion

    I'm getting a little bummed out with this problem. I have tried many things, but still can't burn a useable CD with MP3 music on my Mac. When I try it, it seems to burn it, but the disc won't play in any of my CD players. Why does Mac make it so hard

  • Problem opening Office documents from KM

    Hello, I have some problem opening Office documents from KM. We stored a lot of office documents (Excel, Word ecc.) in a File System repository (the standard repository "/documents"), when I open one of these files, before to view the document, a lit

  • URGENT: How to add an URL link to an Image?

    Hi, I need to be able to link a web page from an image . How can I do this using Oracle Portal? Many THANKS Mariela

  • Problem with ni9505

    When i use NI9505 to control step motor, use example code(closed loop), motor can run, but can not stop. for example, i want run  1000 steps, motor run and the encoder value may be a value close to 1000, but can not stop, why?