media_tag filter to turn an image or video value into complete HTML
markup:
url or src
key. It returns an empty string for an empty input.
Fluid renders a <video> when the media type is video or when the URL path
ends in .mp4, .mov, .webm, or .m4v. Other inputs render as <img>.
Render responsive images
For an image on Fluid’s ImageKit host, the default output includes:- A
srcsetwith widths400,800,1200, and1600 sizes="100vw"- ImageKit quality
80and formatauto loading="lazy"anddecoding="async"- An empty
altvalue unless the input supplies alt text
When the input includes intrinsic dimensions, Fluid adds
width and height
attributes. It also caps the responsive width ladder at the intrinsic width.
For a fixed-size image, pass width:
240w and 480w renditions and sets sizes="240px".
Do not add a
w- token to transform. Use width or widths so the
transformation stays aligned with srcset.Render videos
ImageKit-hosted videos request MP4 output by default. Fluid also generates a poster URL from the first frame unless you supplyposter.
autoplay, loop, muted, and playsinline.
playsinline is added automatically when you enable muted or autoplay.
Handle external media and attributes
For media outside Fluid’s configured ImageKit host, the filter preserves the original URL. External images do not receive a transformedsrcset. External
videos do not receive an ImageKit format transformation or generated poster.
Options such as class, id, style, data-*, and fetchpriority pass
through as HTML attributes. Fluid escapes attribute values and removes every
attribute whose name starts with on, such as onerror or onload.
For direct URL transformations, see
image transformations. For available theme
data, see theme variables.