Embed png image in html file using Jinja2

落花浮王杯 提交于 2020-01-13 23:55:14

问题


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?


回答1:


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 :)



来源:https://stackoverflow.com/questions/4819136/embed-png-image-in-html-file-using-jinja2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!