Question

We are building a browser extension that makes a call to a RESTful webservice that returns HTML and places this HTML into the Compose box of GMAIL. The issue we are running into is with images. We want the images to be placed directly into GMail as opposed to linking to a URL on our server. Anyone have an idea on how we could approach this problem?

Was it helpful?

Solution

Put the image data right in the tag as follows:

<img src="data:image/gif;base64,R0lGODlhEAAO..." />

Effectively all your doing is taking the binary data, base64 encoding it, and then just putting it right on the tag. The client will recognize that it doesn't need to make a request for the image, but rather just render the data given in the tag.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top