R E S P O N S I V E I M A G E S U
N
D
E
R
C O
N
T R
O
L
Slide 2
C R I S T I N A D E S
I G N E R
&
C H U M I L L A S D R U P A L
F R O N T E N D
@ chum i l l as c kri n a @chumillas
#DrupalCampES
Slide 3
RESPONSIVE IMAGES THE BASICS R E S P O N S I V E I M AG E S I N D R U PA L ART DIRECTION WYSIWYG
Slide 4
A V
E
R
A G
E
PAG E W E I G H T
20 1 6 20 1 5 20 1 4
@chumillas
2 , 48 Mb + 10 % 2,26 Mb + 16 % 1,95 Mb + 15 %
#DrupalCampES
Slide 5
FACTS
61% web traffic
@chumillas
ASYNCHRONOUS reque st
TOO BIG for th e d e v i ce
#DrupalCampES
Slide 6
DELIVER
THE
HIGHEST QUALITY IMAGE SUPPORTED AND
@chumillas
NOTHING
MORE.
#DrupalCampES
Slide 7
T H E
B A S I C S
Slide 8
SCALED IMAGE Variables known by:
AUTHOR when she’s writing the code?
BROWSER when it’s loading the page?
viewport dimensions
x
YES
image size relative to the viewport
YES
YES via sizes!
screen density
x
YES
source files’ dimensions
YES
YES via srcset!
SOURCE https://ericportis.com/posts/2014/srcset-sizes
B R O W
S
E R
S
U P P O R T
P I C T U R E
Same for srcret and sizes
@chumillas
#DrupalCampES
Slide 18
B R O W
S
E R
S
U P P O R T
P I C T U R E F I L L
http://scottjehl.github.io/picturefill/ A
R E S
@chumillas
P O N
S
I
V E
I
M
A G E
P O L Y F I
L L
#DrupalCampES
Slide 19
R E S P O N S I V E
I M A G E S
I N
D R U P A L
Slide 20
D R U P A L
7
RESP_IMG > PICTURE BREAKPOINT COMMITERS: Jelle_S, attiks,…
ADAPTIVE IMAGES AIS (ADAPTIVE IMAGE STYLES) C L I E N T- S I D E A D A P T I V E I M A G E
@chumillas
#DrupalCampES
Slide 21
M O D U L E S RESPONSIVE IMAGES (Picture) BREAKPOINT Image,File,Field
@chumillas
#DrupalCampES
Slide 22
P R O C E S S
1 Import/ create breakpoints
@chumillas
2
3
4
Create Image styles
Create Responsive Images
Apply Responsive Images
#DrupalCampES
Slide 23
W
H E R E
B R E A K P O I N T S THEMES
@chumillas
1
MODULES
#DrupalCampES
Slide 24
W
H
A T
A R E
B R E A K P O I N T S 1
@media all and (min-width:851px) {/CSS/}
@chumillas
#DrupalCampES
Slide 25
P L
I M A G E
( mi n - wi d th: 480px )
A N
S T Y L E S
(min- w id t h: 8 3 0px )
2
Slide 26
P L
I M A G E
A N
S T Y L E S 8 3 0 px - 40 px marg in s - 20 px gut te r 7 70 px /2 i mages 3 8 5 px
2
Slide 27
P L
I M A G E
A N
S T Y L E S
2
2 4 0 px +25%
3 0 0 px +25%
3 8 5 px +25%
4+25% 8 0 px
240 px 300 px 385 px 480 px
240 px 300 px 385 px
3 85 px 4 80 px
By @marcdrummond https://www.youtube.com/watch?v=3BF5WE_NOIU
Slide 28
C
R E A T
R E S P O N S I V E
E
I M A G E S
3
3 1 Import/ create breakpoints
@chumillas
2
Create Image styles
SCALED IMG
3 PICTURE
4 Apply Responsive Images
#DrupalCampES
G I
A R T
V E S
B A S I C D I R E C T I O N
R E Q U I R E S
L O W
E F F O R T ( R E A L L Y
)
Slide 43
W Y S I W Y G
Slide 44
R E S
P O N S
I N S I D E
I V E
I M
A G E S
W Y S I W Y G
https://www.drupal.org/project/inline_responsive_images *https://www.drupal.org/node/2061377 @chumillas
#DrupalCampES
Slide 45
C O N C L U S I O N S
@chumillas
•
Plan your Responsive Images before implementing.
•
Use Focal Point if you don’t need full control.
#DrupalCampES