The HTML <img> tag supports two methods for displaying images:
Using a Hosted image URL
<img src="https://unsplash.com/photos/a-puffin-peeks-out-from-white-flowers-V7KIXbMOuJw" / >Using an Embedded Base64 Image<img src="data:image/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAApsAAAC4CAYAAACsNSfVAAAAAXNSR0IAr...." / ><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAApsAAAC4CAYAAACsNSfVAAAAAXNSR0IAr...." />By embedding images directly into the communication template, the image becomes self-contained and no longer depends on an external hosting location.
Converting an Image to Base64
An image can be converted into a Base64 string using various free online conversion tools.
- Download the image from its source URL or local location
- Upload the downloaded image to a Base64 conversion website
- Click the Encode button to generate the Base64-encoded string
- Copy the generated string and use it within the HTML img tag
Adding a Static Image in Maximo Communication Templates
A static image can be added to a Communication Template either through the MAS UI or by updating the database directly.
Open the Communication template and insert an image using the Insert Image Icon.
Click "View HTML Source" to modify the underlying HTML and add a static image using a Base64-encoded string.
update commtemplate
set message = replace (
message,
'http://hostname/images/logo.jpg',
'data:image/jpg;base64,/9j/4QC8RXhpZgAASUkqAAgAAAAGABIBAwABAAAAAQAAABoBBQABAAAAVgAAABsBBQABAAAAXgAAACgBAwABAAAAAgAAABMCAwABAAAAAQAAAGmHBAABAAAAZgAAAAAAAABgAAAAAQAAAGAiQnm=' )
where status ='ACTIVE'; - Base64 images increase the overall HTML message size and performance.
- This method is best suited for small static images (icons, banners etc.,) which don't change often.
- If the image changes frequently or is large in size, hosting it externally may be a better option.
No comments:
Post a Comment