Sometimes when we have to deal with dynamic images in web application, we can't just use the link refer to any image because we just want to generate it for temporary purpose. In order to solve this problem, HTML is be able to read an image data in form of base64 string then show an image in the browser.
It's a simple to express an image in string format using the following template:
<img src="data:image/[format];base64,[base64 image string]"/>
Example:
<img src="data:image/png;base64,iVBORw0KGgoAAAANS..."/>In the next post, I will write about how to get base64 string from an image.
Reference: Embedding Base64 Image Data into a Webpage
No comments:
Post a Comment