11ty / eleventy-img

Utility to perform build-time image transformations.
https://www.11ty.dev/docs/plugins/image/
436 stars 54 forks source link

Eleventy Transform: Use existing width attribute, if set #234

Open bamnet opened 4 months ago

bamnet commented 4 months ago

It's really neat how the eleventyImageTransformPlugin will automatically enhance img tags.

If an img tag already has a width attribute set, it would be helpful if the plugin used that value instead of requiring users to rename the attribute to eleventy:widths.

Example:

<img src="foo.jpg" width="600"> will return the full sized image. The transform plugin silently drops the width parameter. This is confusing and perhaps not what people expect (at least not what I expect).

<img src="foo.jpg" eleventy:widths="600"> fixes it.

sarajw commented 1 month ago

Aha! yes please. This has just confused me too: https://front-end.social/@sarajw/113301301029944772