Sometimes, you want to control and customize the display of a BLOB column using an HTML <img>
tag. Since BLOB columns cannot be referenced by column substitutions (e.g. #COLUMN_NAME#), you need to get the BLOB column value as a URL. Once you have the URL, you can format the display of the image using an HTML <img>
tag. To get the BLOB as a URL, you have these 3 options:
- Define a Media Resource RESTful Service
- Define an On-Demand Page or an Application Process to display an Image from a BLOB column
- Use the APEX_UTIL.GET_BLOB_FILE_SRC API. Bear in mind, this API requires a reference to a valid File Browse page item that exists somewhere in the app.
A Media Resource RESTful Service is the preferred implementation method, but to make this app self contained, this page uses method #2 (above).
- Page item P5_EMPNO hidden item added
- Ajax Callback GETIMAGE calls eba_demo_card_pkg.get_profile_image
- Procedure eba_demo_card_pkg.get_profile_image initiates BLOB column download as inline
- The href value of the
<img>
tag in the Cards Media HTML Expression calls the GETIMAGE ajax process while also passing the EMPNO column value