srcset-loader icon indicating copy to clipboard operation
srcset-loader copied to clipboard

'ratio' should be promoted

Open tremby opened this issue 8 years ago • 0 comments

In my opinion ratio shouldn't be at img.placeholder.ratio but instead promoted to img.ratio. It's a property of the original image, not just of the placeholder, and is useful even when not using the placeholder.

For example, browsers like when width and height attributes are given, since it means the page can be laid out sooner. This can be done with the ratio and a reference size:

<!-- current ratio implementation (ratio=height/width) -->
<img ... width="250" height="{{Math.round(250 * img.placeholder.ratio)}}">

<!-- ratio implementation from #16 (ratio=width/height) -->
<img ... width="250" height="{{Math.round(img.placeholder.ratio / 250)}}">

I think this should be possible even if the placeholder is not being calculated.

tremby avatar Sep 13 '17 18:09 tremby