The site setting Generate picture tag is on. Every image rendered through getHtml(), and every image in rich text, becomes a <picture> with a WebP source, an original-format source and an <img> fallback, plus 2x versions when the image was resized and the original is large enough. Your attributes are on the inner <img>. Inside a hand-written picture element use getPath(), not getHtml().
Answer
Images
My image came out as a picture tag with sources I did not ask for
More in Images
- A WebP version is being served to a browser that cannot display it
- A resized image is blurry or the wrong crop
- An inline width style disappeared from the rendered image tag
- The first visitor to a page waits noticeably longer than the second
- An image URL with resize parameters returns the original size
Was this page helpful?
Your answer goes to the docs team.