4 Replies Latest reply: Dec 13, 2013 6:14 PM by Mike Kutz RSS

    Use same image column twice in a report

    pravish

      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

          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

            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

              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

                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