On Github yoavweiss / respimg-edge-presentation
Edge - NYC, September 2013
I'm here to talk a little about responsive images. I have to squeeze in over 2 years of discussions into a 10 minutes presentation, so I'm gonna give it a try :)Mid 2000s, mobile only sites. Very light weight.
iPhone, slightly more content, but still mobile-only
RWD became a thing
One code base to rule them all
Awesome
Mobile experience became better, but slower
Serving the same resources to mobile and desktop hurts performance
On mobile the images are much smaller and some of them are not even displayed
Devs can choose between HQ and LQ for everybody
Usually pick HQ
Serving different image dimensions to different devices
Image resources only differ in quality. proportions stay the same
Getting images to match layout
Fit layout and optimal content without wasting bytesThe good old img tag, now with extra attributes!!!
Mainly res-switch, because browser can override
Browser can override means "browser can optimize"
<img src="cat.1X.jpg" srcset="cat.1x.jpg 1x, cat.2x.jpg 2x">
Implemented in WebKit and Blink
Firefox will soon follow
<img src="cat.1X.jpg" srcset="cat.1x.jpg 1x 320w, cat.2x.jpg 2x 320w, cat.2x.jpg 1x 640w, cat.4x.jpg 2x 640w, cat 4x.jpg 1x 1280w">
I have a feeling the viewport switching implementation is not far behind.
"I have a feeling" == "I intend to implement it"
<picture> <source media="screen and (min-width:1600px)" srcset="wide1x.jpg 1x, wide2x.jpg 2x"> <source media="screen and (min-width:800px)" srcset="middle1x.jpg 1x, middle2x.jpg 2x"> <source media="screen and (min-width:400px)" srcset="narrow1x.jpg 1x, narrow2x.jpg 2x"> <source srcset="tiny1x.jpg 1x, tiny2x.jpg 2x"> <img src="fallback.jpg"> </picture>
CH-DPR: 2.0 CH-VW: 2.0 CH-VH: 2.0 CH-OtherVar: x.x
Not sent on first HTML request
336x635
106x200
211x400
336x635
770x512
200x200
400x288
770x512
No markup
single file
can download diff
complicated
decoding perf?
Fetching mechanism
RWD - http://www.flickr.com/photos/axbom/6263640150/sizes/o/in/photostream/
Bloat - http://www.flickr.com/photos/lorenjavier/5013332959/sizes/l/in/photostream/
CNN - http://mobile.smashingmagazine.com/2010/11/03/how-to-build-a-mobile-website/