Search code examples
oracleoracle-apexfacetfaceted-searchoracle-apex-19.2

how to add Image instead of Icon in card Template - Oracle Apex


I have a classic report with the standard query for a card in the classic report for the search results of a faceted region but the it main focus is getting it to query from the database and showing on the card as an image instead of an icon (i.e. i want to put an image where the card icon normally is). I tried googling it and altering the template but i have found no solution.

Please note this is in Oracle Apex 19.2

enter image description here

The code includes

SELECT
    id,     
    decode(nvl(dbms_lob.getlength(LOADED_PHOTO),0),0,null,
       '<img alt="'||apex_escape.html_attribute(name)||'" title="'||apex_escape.html_attribute(name)
              ||'" style="border: 4px solid #CCC; -moz-border-radius: 50%; -webkit-border-radius: 50%;" '
              ||'src="'||apex_util.get_blob_file_src('P586_LOAD_PHOTO',id)||'" height="75" width="75" />') CARD_ICON,           
              
    'My Company' CARD_TITLE,   
    'This is my Company' CARD_TEXT,  
    'Subtext of my company' CARD_SUBTEXT
FROM  dual

Any help would be appreciated Thanks


Solution

  • I think you are not including the mimetype as the documentation says.

    https://docs.oracle.com/en/database/oracle/application-express/19.1/aeapi/GET_BLOB_FILE_SRC-Function.html#GUID-21F2D33A-A616-48B5-BAF5-A85C0EDC998F

    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