This discussion is archived
4 Replies Latest reply: Dec 13, 2013 4:14 PM by Mike Kutz RSS

Use same image column twice in a report

pravish Newbie
Currently Being Moderated

Hello,

 

I have a question  which is, can I use a same image column (example column A) twice in a report? first occurrence (column A) will show the image thumbnail and the second occurrence (column A) will show  image download link which opens image in a new window. Is it possible?

 

Thanks

Pravish

  • 1. Re: Use same image column twice in a report
    fac586 Guru
    Currently Being Moderated

    pravish wrote:

     

    I have a question  which is, can I use a same image column (example column A) twice in a report? first occurrence (column A) will show the image thumbnail and the second occurrence (column A) will show  image download link which opens image in a new window. Is it possible?

    Why are you asking? Why not just try it out?

  • 2. Re: Use same image column twice in a report
    LA-APEX-DEv Explorer
    Currently Being Moderated

    Yes, it's possible. However, if you intent to have two different images, then I would suggest you use a javascript to link or download the blob.

     

    To accomplish this task, you either use decode or create a union query. For example:

     

    select '<a href="javascript:downloadImg(' || image_id || ');"><img src="/i/download.gif"></a>' link_col

    from table

    where allow_view = 'Y'

    union all

    select '<img src="/i/folder.gif">' link_col

    from table

    where allow_view = 'N'

     

    or

     

    select decode(allow_view,'Y',

              '<a href="javascript:downloadImg(' || image_id || ');"><img src="/i/download.gif"></a>',

              '<img src="/i/folder.gif">') link_col

    from table

  • 3. Re: Use same image column twice in a report
    fac586 Guru
    Currently Being Moderated

    LA-APEX-DEv wrote:

     

    Yes, it's possible. However, if you intent to have two different images, then I would suggest you use a javascript to link or download the blob.

    What on Earth for? Why is JavaScript necessary to download two different images? Even if this were in any way true, the OP is clear that the displayed thumbnail and download link involve the same image.

    To accomplish this task, you either use decode or create a union query.

    No, all that should be necessary is to reference the image column twice in the report query projection, and apply a download format mask to one column and an image mask to the other. That the OP has apparently failed to do this probably indicates that they are unnecessarily complicating things.

    For example:

     

    select '<a href="javascript:downloadImg(' || image_id || ');"><img src="/i/download.gif"></a>' link_col

    from table

    where allow_view = 'Y'

    union all

    select '<img src="/i/folder.gif">' link_col

    from table

    where allow_view = 'N'

     

    or

     

    select decode(allow_view,'Y',

              '<a href="javascript:downloadImg(' || image_id || ');"><img src="/i/download.gif"></a>',

              '<img src="/i/folder.gif">') link_col

    from table

    What is downloadImg? it is not a standard APEX JavaScript API. It is therefore highly unlikely that this is of any use to the OP.

  • 4. Re: Use same image column twice in a report
    Mike Kutz Expert
    Currently Being Moderated

    Depending on the size of the image, you really should have a column specifically for thumbnails.

    The server just spits the image back out as-is and the browser is the one that resizes it.

    So, if you have 5MB images... you will be downloading 15 * 5MB of data for each page of the report.

     

    If you want, you can resize images inside the database using the ORDImage data type.

    (I don't know if this is available in XE)

     

    I've got a sample app on apex.oracle.com that does this.

     

    MK

Legend

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