bbc / Imager.js

Responsive images while we wait for srcset to finish cooking
Apache License 2.0
3.84k stars 224 forks source link

[PROPOSAL] Updading `src` only if the size gets bigger #48

Closed thom4parisot closed 10 years ago

thom4parisot commented 10 years ago

tl;dr

Don't waste radio effort to download a better quality image as the browser can just redimension it.

Use Case

<div style="width: 480px">
  <img src="/assets/480/example.jpg" data-src="/assets/{width}/example.jpg" class="responsive-img">
</div>

Should become:

<div style="width: 240px">
  <img src="/assets/480/example.jpg" data-src="/assets/{width}/example.jpg" class="responsive-img">
</div>

Instead of:

<div style="width: 240px">
  <img src="/assets/240/example.jpg" data-src="/assets/{width}/example.jpg" class="responsive-img">
</div>

Pros

I guess waking up the radio has a much higher latency though. To be confirmed.

^ Resize? Resize? No Resize!