image_data_url
See also
Media developer guide.
See also
Media classes for some options that are only available in mediaclass files.
See also
image, image_url and media tags.
Generate a data: url of a still image.
The {% image_data_url %} tag is used generate a data url with the image data.
{% image_data_url %} accepts all parameters of the {% image %} tag but only outputs a data url and not the <img\> element to display it.
Example:
{% image_data_url "lib/images/trans.gif" %}
Generates:
data:image/gif;base64,R0lGODlhAQABAJAAAAAAAAAAACH5BAEUAAAALAAAAAABAAEAAAICRAEAOw==
The image_data_url tag can be used in image tags or in css:
<img src="{% image_data_url 'lib/images/trans.gif' %}">