Skip to main content


 

Symptoms

 


How to add SmartObject Image fields into an email.
 

 

Diagnoses

 


When you store an image in a SmartObject Image field, it encodes it as a Base64 string (the long string of garbled text you see in an email).
 

 

Resolution

Base64 can be used in an HTML IMG tag via the format :

 

 

 

<img src="data&colon;image/png;base64,iVBORw0KG..." alt="Header/Footer Image" />

 

 

 

 (this example is specifically for a png image). So, you can use your SmartObject Image field's sub-field of 'Content' instead of hard-coding a string, like this:

 

 

 

<img src="data&colon;image/png;base64,iImage Content]" alt="K2 Embedded Image" />

where 'Image' is the name of your SmartObject Image field and 'Content' is its sub-field.

There is an issue with this though: the tImage Context] context part gets encoded like a URL and will not render with the correct string. You can get around this by creating a Data Field with the above IMG tag and bImage Content] field, and dragging the Data Field into your email. Note that some older browsers may not display Base64 images correctly. There were problems rendering the image in an old version of Outlook, but OWA loaded it just fine.

Regarding this last point, if the Base64 rendering is not working, I suggest hosting your images locally somewhere and just storing the image URLs in a SmartObject, instead of the raw images. You can create an IMG tag that uses 'src=gImage URL]'.

 

 



 
Be the first to reply!

Reply