Open benallfree opened 1 week ago
Can you share an example of what the HTML output looks like now vs what it's supposed to look like?
@benmccann Let's assume foo.png
is a 500x500 retina image. In other words it's stored at 2x resolution and should display at 250x2t50 logical pixels.
<enhanced:img "./foo.png">
currently renders something like:
<img src="./foo.png" width="500" height="500" />
With the proposed update,
<enhanced:img "./foo.png" retina>
would render
<img src="./foo.png" width="250" height="250" />
Describe the problem
@sveltejs/enhanced-img renders the
img
tag using intrinsic dimensions, which causes incorrect rendering if the image is a 2x retina image.Describe the proposed solution
I propose a boolean prop,
<enhanced:img retina>
that will set theimg
width/height to the correct logical dimensions: 1/2 the intrinsic dimensions.Alternatives considered
Importance
nice to have
Additional Information
Here is a crude patch just to show the essence: