# image\_data\_url

Source: https://zotonic.com/docs/1368/image_data_url

URI: https://zotonic.com/id/1368

Language: en



::: {.aside}
See also

- [Media](/id/doc_developerguide_media#guide-media) developer guide.
- [Media classes](/id/doc_developerguide_media#guide-media-classes) for options that are only available in mediaclass files.
- <a href="/id/doc_template_tag_tag_image" class="doc-reference doc-reference-tag"><code>tag#image</code></a>, <a href="/id/doc_template_tag_tag_image_url" class="doc-reference doc-reference-tag"><code>tag#image_url</code></a> and <a href="/id/doc_template_tag_tag_media" class="doc-reference doc-reference-tag"><code>tag#media</code></a> 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:

```django
{% image_data_url "lib/images/trans.gif" %}
```

Generates:

```erlang
data:image/gif;base64,R0lGODlhAQABAJAAAAAAAAAAACH5BAEUAAAALAAAAAABAAEAAAICRAEAOw==
```

The `image_data_url` tag can be used in image tags or in css:

```erlang
<img src="{% image_data_url 'lib/images/trans.gif' %}">
```

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1368?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1368?language=en>)
