Tuesday, 1 October 2013

Show Base64 file as PNG

Show Base64 file as PNG

Images are captured by one part of our system as PNG files and then base64
encoded and stored on Amazon S3. We'd like to display these images in HTML
emails that are sent and the obvious issue is that they are base64
encoded.
Linking directly to the object doesn't work, and it seems that using an
image tag such as the following does not display the image in any email
client I've tried (Gmail, Live/outlook.com, Outlook, Apple Mail):
<img src="data:image/png;charset=utf-8;base64,http://url/filename" />
Any ideas? I don't have control over the fact that the objects are written
as Base64. I could read/download the objects ahead of time but cannot
write to the file system, so any real-time conversion would need to be
done in memory. Hoping for a solution that leverages HTML. This is not a
background image - it will be in the body itself.
Edit: I've also tried just putting the base64 string in place of the URL -
which works in some cases, but some email clients (like Gmail) won't
display it - which is why I'm preferring a URL-based solution.

No comments:

Post a Comment