Overview
The {{ glide:data_url }}
tag works in a very similar way to the standard Glide tag, except it outputs the manipulated as a Data URL.
Example
You may pass any parameters you'd normally pass to the Glide tag, like width
, height
and format
.
{{ glide:data_url src="image.jpg" width="1280" height="800" format="webp" }}
{{ Statamic::tag('glide:data_url') ->src('image.jpg') ->width(1280) ->height(800) ->format('webp')}}
data:image/webp;base64,R0lGODlhAgACAJEAALwWrOQqhOwqhP///yH5BAEAAAMALAAAAAACAAIAAAIDBBIFADs=
Parameters
src|path|id
The URL of the image when not using the shorthand syntax. (Use the shorthand syntax if you can, it's nicer.) This also accepts asset IDs, if using private assets, for example.
tag
When set to true, this will output an <img>
tag with the URL in the src
attribute, rather than just the URL.
alt
When using the tag
parameter, this will insert the given text into the alt
attribute.
preset
Use a preset of pre-configured parameters. Learn more.