W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2012

Re: [whatwg] Implementation complexity with elements vs an attribute (responsive images)

From: Kornel Lesiński <kornel@geekhood.net>
Date: Mon, 14 May 2012 23:04:48 +0100
To: Odin Hørthe Omdal <odinho@opera.com>
Message-ID: <op.webjmayate2ec8@aimac.local>
Cc: whatwg <whatwg@whatwg.org>
On Mon, 14 May 2012 01:30:20 +0100, Odin Hørthe Omdal <odinho@opera.com>  

> All optional replacements of the src will have to be fitted in the same
> box as the original src. That might actually require you to specify both
> width and height upfront. Of course, people won't really do that, so I
> guess we're bound to get differing behaviour... Hm.
> What do people think about that? What happens here? You have no info on
> the real size of the picture. I guess maybe the browser should never
> load any srcset alternatives then? If you have no information at all
> it's rather hard to make a judgement.
> A photo gallery wants to show you a fullscreen picture, and give you:
>    <img src=2048px.jpg srcset="4096px.jpg 2x">
> In this example, us (humans :P) can easily see that one is 2048 px and  
> the other 4096 px. If I'm viewing this on my highres Nokia N9, a naïve
> implementation could pick the 2x, because it knows that's nicely highres
> just like its own screen.
> But it would actually be wrong! It would never need anything else than
> the 2048 px for normal viewing because it is anyway exceeding its real
> pixels on the screen.

If srcset/<picture> provides authors with good way to serve images at most  
appropriate size, they won't need to resort to tricks with downsizing  
high-res images to smaller size.

For a full-width image on a ~960px viewport (assuming author doesn't have  
better sizes available) this would be appropriate:

   <img src=2048px.jpg srcset="2048px.jpg 2x, 4096px.jpg 4x"  

regards, Kornel Lesiński
Received on Monday, 14 May 2012 22:05:44 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:13 UTC