“Mo’ Pixels,
Mo’ Problems”
Dealing with Responsive Images
with Dave Rupert @davatron5000
Slide 2
Slide 2 text
“!is is why
Daddy drinks
at night.”
Slide 3
Slide 3 text
+ + +
(slang)
(place) (personal brand) (sound)
Slide 4
Slide 4 text
paravelinc.com
Slide 5
Slide 5 text
shoptalkshow.com
Slide 6
Slide 6 text
No content
Slide 7
Slide 7 text
Le menu
• Discovery of Findings: Key Issues and Data Points
• Identify Primary Blockers for the Agile Web
• Leverage the Paravel Image Biz-Strat
• Cloud-based Cutting Edge E-Solutions
• Sweet Hacks, Bro
Slide 8
Slide 8 text
Le Problème
Like all Americans, websites are getting
more and more obese.
#sickburn
Slide 9
Slide 9 text
HTML, CSS, JavaScript, Images, Fonts, Flash?, etc.
of page load times are
because of the front end.
80%
Slide 10
Slide 10 text
kilobytes == average page
weight in October 2013.
1,617
Up 333kb (25%) from January 2013.
Slide 11
Slide 11 text
kilobytes == images
(~56 of them)
988
Up 195kb (24.5%) from January 2013.
Slide 12
Slide 12 text
of page weight is images.
~60%
Source: HTTPArchive.org
Slide 13
Slide 13 text
Les Facteurs
What’s causing all this image bloat?
Slide 14
Slide 14 text
№1
Bad Web
Performance
Websites keep getting fatter.
Slide 15
Slide 15 text
kilobytes == average page
weight in April 2013
1,617
kilobytes == size of
moto.oakley.com
87,962
cost to view moto.oakley.com on
Verizon’s smallest plan
$22
Don’t worry, Oakley got the site down to 13.7 MBs (84% improvement!)
Slide 16
Slide 16 text
millisecond delay
500
reduction in tra"c
20%
http://www.codinghorror.com/blog/2006/11/speed-still-matters.html
Slide 17
Slide 17 text
№2
Responsive
Web Design
One website to rule them all.
Slide 18
Slide 18 text
“Blame the
implementation
not the technique”
– Tim Kadlec
Slide 19
Slide 19 text
of RWD sites send the same
payload to mobile and desktop.
72%
Only 6% were “much smaller”
http://www.guypo.com/?p=3374
Slide 20
Slide 20 text
Unofficial findings from the
Dave Rupert Arm Chair Research Institute
“Expect RWD to
bloat things ~10%”
Slide 21
Slide 21 text
№3
Retina Screens
LOL. YOUR JOB JUST GOT SOOOOoOO MUCH
MORE DIFFICULT! LOLOLOLOL
— Steve Jobs, from the grave.
Slide 22
Slide 22 text
No content
Slide 23
Slide 23 text
LOL. I’m 3x!
Slide 24
Slide 24 text
Considérations
Breakpoints Densities Art direction
Slide 25
Slide 25 text
Breakpoints
Slide 26
Slide 26 text
Densities
Slide 27
Slide 27 text
Art direction
http://blog.cloudfour.com/a-framework-for-discussing-responsive-images-solutions/
Slide 28
Slide 28 text
The Paravellian®
Approach
Use CSS and Web Fonts whenever possible
Use SVG and Icon Fonts whenever applicable
Use a Responsive Images Solution
Slide 29
Slide 29 text
CSS &
Web Fonts
Slide 30
Slide 30 text
No content
Slide 31
Slide 31 text
.pizza {
background-image: url("pizza.png");
}
!
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (min--moz-device-pixel-ratio: 1.5),
only screen and (min-resolution: 240dpi) {
.pizza {
background-image: url("[email protected]");
background-size: 400px 300px;
}
}
16kb + 46kb = 62kb (+33% Not ideal, but maybe okay)
Slide 56
Slide 56 text
@56 Images: 896kb + 2.576MB = 3.472MB
Slide 57
Slide 57 text
Other paths
spacer.gif
Background-images
Elements
Servers and cookies
Network Detection
Slide 58
Slide 58 text
Les candidats
@srcset
Slide 59
Slide 59 text
N
CHALLENGER
APPROACHING
A new foe has appeared!
Slide 60
Slide 60 text
Les candidats
@srcset
srcN
Slide 61
Slide 61 text
@srcset
Based on the CSS4 image-set() value
Proposed by Apple® on May 10th, 2012
Slide 62
Slide 62 text
@srcset syntax
Slide 63
Slide 63 text
No content
Slide 64
Slide 64 text
LATE BREAKING NEWS
IN AUGUST, WEBKIT SHIPPED @SRCSET WITHOUT THAT
WEIRD ‘600w’ SYNTAX. WILL LIKELY BE DROPPED.
Slide 65
Slide 65 text
*CURRENT* @srcset syntax
Slide 66
Slide 66 text
Strengths
Just an attribute
Strong “2x” syntax
Weaknesses
Comma delimited values
Faux-media query microsyntax
Non-intuitive px-based “w” and “h” units
Browser determination
Polyfill causes the double download
Breaks preloader
Slide 67
Slide 67 text
Proposed by the Responsive Images Community Group
on May 11th, 2012
Slide 68
Slide 68 text
syntax
Slide 69
Slide 69 text
Strengths
Audio/Video element syntax
Media-query based
Supports non-pixel values
Supports art direction
Uses @srcset’s “2x” powers
Fallbacks for unsupported types
Weaknesses
Verbose
Breaks preloader
“Hard to implement”*
* Citation needed
Slide 70
Slide 70 text
Picturefill
https://github.com/scottjehl/picturefill
Start using the picture element today!
Slide 71
Slide 71 text
BREAKING NEWS
HAS BEEN RELEGATED TO BEING A “NOTE” ON
THE NEW SRC-N PROPOSAL.
Slide 72
Slide 72 text
“It’s icky”
- Browsers
“It’s icky”
- Browsers
Slide 73
Slide 73 text
srcN
Proposed by Tab Atkins (Google)
on September 25th, 2013
Slide 74
Slide 74 text
syntax
Slide 75
Slide 75 text
srcN syntax
Slide 76
Slide 76 text
Variable sized images
Slide 77
Slide 77 text
Viewport URL
Slide 78
Slide 78 text
Strengths
Media-query based
Supports non-pixel values
Supports art direction
@srcset’s “2x” powers
Viewport-URLs
“Easy to implement”??
Weaknesses
Ordinal Attributes?
Fallbacks for unsupported types?
Slide 79
Slide 79 text
“Sure, fuck it,
whatever…”
— A wise developer one time
Slide 80
Slide 80 text
ch
CHALLENGER
APPROACHING
A new foe has appeared!
Slide 81
Slide 81 text
Client Hints
Proposed by Ilya Grigorik (Google)
––enable-client-hints
Slide 82
Slide 82 text
GET /img.jpg HTTP/1.1
!
Accepts: image/jpg
CH-DPR: 2.0
CH-RW: 160
How a client hinted browser requests an image
Slide 83
Slide 83 text
Detects DPR >= 1.5
Slide 84
Slide 84 text
GET /img.jpg HTTP/1.1
!
Accepts: image/webp, image/jpg
CH-DPR: 2.0
CH-RW: 160
How a Blink requests an image
Slide 85
Slide 85 text
Detects WebP support
Slide 86
Slide 86 text
No content
Slide 87
Slide 87 text
Slide 88
Slide 88 text
Slide 89
Slide 89 text
rif
CHALLENGER
APPROACHING
A new foe has appeared!