Izik
Izik

Reputation: 948

Oracle apex how to display in report images from collection

I'm trying to display an image from a collection.

The current methods (apex_util.get_blob_file_src / dbms_lob.getlength) don't seem to work, since this is a collection and not a Table. I'm able to create a download link of the image/file but not display it. Any ideas on how to display images from collection in a report?

The report query looks like that (without the section to display image)

select
    seq_id as "Seq id",

    n001 as "Id",

    '<a href="' || apex_page.get_url(p_page => 3003, 
                                 p_clear_cache => 3003,
                                 p_items => 'P3003_SEQ', 
                                 p_values => seq_id)
        ||'">' || c002 || '</a>'
    as "Download document"

from APEX_COLLECTIONS
where collection_name = 'COLLECTION_DOCS';

Thanks

Upvotes: 0

Views: 1080

Answers (1)

hartenfeller.dev
hartenfeller.dev

Reputation: 156

You could transform the image to base64 with a function and use the output in the img src attribute.

Here is some code to transform the blob to a base64 encoded clob.

Afterwards you can use that clob in an HTML img tag:

<img alt="" src="data:'|| img_mime_type || ';base64, '|| base64_img || '">

You need to set the mime type based on your image format. E. g. for png use "image/png".

Upvotes: 1

Related Questions