Reputation: 11872
I have a couple small images in an HTML document that I want to make portable, e.g. still works when emailing. I use the following, which works great:
<img src="data:image/png;base64,..."/>
Problem is, I want to use the same image many times in the document, but don't want to repeat the entire base64 data string. I have seen in emails where the data is encoded a single time, but referenced many. Is this possible with HTML?
Upvotes: 12
Views: 4376
Reputation: 16825
Configure your webserver to zgip (/deflate) your content. Deflate should detect the repeating string and compress to about the same size as you would have if you only included it once. This way you won't waste bandwidth. Doesn't work for email, or for plain html-file in filesystem.
Upvotes: -1
Reputation: 490123
If you can use CSS, you could place it there instead, as a class.
Then just add the class to the elements you want.
Upvotes: 9