VacuumTube
VacuumTube

Reputation: 4131

Embed png image in html file using Jinja2

I'm using Jinja2 to create html reports as a single html file. I would like to include the company logo inside the html file rather than link to it; in this way the logo is displayed even if the person reading the report is offline. Can this be automatically done using Jinja2? If not how can I embed a png image in the html manually?

Upvotes: 2

Views: 3911

Answers (1)

Maximilian Ehlers
Maximilian Ehlers

Reputation: 328

look for a Base64 encoder on Google (e.g. http://www.opinionatedgeek.com/dotnet/tools/base64encode/). After that you can insert

<img src="data:image/png;base64,BASE64_ENCODED_DATA">

in place for the logo :)

Upvotes: 7

Related Questions