-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
398 lines (353 loc) · 15.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Responsive Images in Drupal - DrupalCamp Colorado 2015</title>
<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Hakim El Hattab">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/sky.css" id="theme">
<link rel="stylesheet" href="css/custom.css">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section id="title">
<h2>Responsive Images in Drupal</h2>
<p><a href="http://bit.ly/riid-dcco15">bit.ly/riid-dcco15</a></p>
<p><a href="http://bit.ly/riid-dcco15-slides">http://bit.ly/riid-dcco15-slides</a></p>
<p><hr></p>
<p>DrupalCamp Colorado 2015</p>
<p><a href="http://twitter.com/hashtag/DCCO15">#DCCO15</a></p>
</section>
<section id="speaker">
<h2>James Nettik</h2>
<p>Front-end Developer for <a href="http://aten.io">Aten Design Group</a></p>
<p><img src="/images/aten-logo.svg" alt="Aten Design Group Logo" class="aten-logo"></p>
<p><hr></p>
<p style="font-size: 70%;">jnettik on<br><a href="http://twitter.com/jnettik">Twitter</a> - <a href="https://github.com/jnettik">GitHub</a> - <a href="http://drupal.org/u/jnettik">Drupal.org</a></p>
</section>
<!-- Intro -->
<section>
<section id="preamble">
<h3>We need to understand a couple things before we talk responsive images</h3>
</section>
<section id="oversimplify">
<h3>We've been oversimplfying images for a long time</h3>
<p class="fragment">Fill our designs with them.</p>
<p class="fragment">Blob them into <abbr title="What you see is what you get">WYSIWYG</abbr> editors.</p>
<p class="fragment">Drupal can distance us from a lot the complexity.</p>
<aside class="notes">
Fill our designs with them. <br>
Blob them into WYSIWYG editors. <br>
Drupal can distance us from a lot the complexity. <br>
They're so much a part of the web, no wonder we're sorta jaded about them
</aside>
</section>
</section>
<!-- Image complexities -->
<section>
<section id="complex-properties">
<h3>Images are complex</h3>
<p>Images come with a lot of unique properties.</p>
<ul>
<li class="fragment">Dimensions: height and width</li>
<li class="fragment">File type: .jpg, .gif, .png, etc.</li>
<li class="fragment">Compression, transparency, animation...</li>
<li class="fragment"><em>File size</em></li>
</ul>
<aside class="notes">
dimensions <br>
file type <br>
depending on file type you get things like... <br>
adds up to file size
</aside>
</section>
<section id="complex-content">
<h3>Images are complex</h3>
<p>At their simplest, images are small pockets of structured content.</p>
<ul>
<li class="fragment"><code>src</code> attribute</li>
<li class="fragment"><code>alt</code> attribute</li>
<li class="fragment"><code>title</code> attribute</li>
</ul>
<aside class="notes">
src <br>
alt <br>
title
</aside>
</section>
</section>
<!-- Image importance -->
<section>
<section id="importance-usage">
<h3>Images are important</h3>
<p>Images make up an increasing majority of every page on the internet.</p>
<ul>
<li class="fragment"><a href="http://httparchive.org/interesting.php">63% of pages are made of images.</a></li>
<li class="fragment"><a href="http://httparchive.org/interesting.php ">1.3Mb of the total page weight.</a></li>
<li class="fragment"><a href="https://medium.com/@guypod/high-performance-images-beautiful-shouldn-t-mean-slow-22ffc4e31663">Use of images has doubled in the last three years.</a></li>
</ul>
<aside class="notes">
63% of page loads <br>
1.3mb of page weight <br>
image use has doubled
</aside>
</section>
</section>
<!-- Responsive complexities -->
<section>
<section id="responsive">
<h3>Responsive images are more complex</h3>
<p>Like every other part of what we do, responsive web design forced us to start thinking about these things, and so much more.</p>
</section>
<section id="responsive-complexities">
<h3>Responsive images are more complex</h3>
<p>On top of the things mentioned above, we also need to consider...</p>
<ul>
<li class="fragment">different resolutions across screens.</li>
<li class="fragment">fluid layouts and changing screen sizes.
<ul class="fragment">
<li>changes in screen orientation as you change devices.</li>
</ul>
</li>
<li class="fragment">browser support for newer file types.</li>
<li class="fragment">metered, expensive, unreliable mobile networks.</li>
</ul>
<aside class="notes">
resolutions <br>
fluid layouts <br>
screens change resolution across devices <br>
browser support <br>
mobile networks
</aside>
</section>
</section>
<!-- Why -->
<section id="why">
<h3>Why do we care?</h3>
<p>Images on the web are a complex problem. We can't expect a simple solution.</p>
<p>Current solutions are not simple...</p>
<p class="fragment" style="margin-top: 2em;">... however, Drupal does make things simpler.</p>
</section>
<!-- The solutions -->
<section id="solution-disclaimer">
<h3>The solutions</h3>
<p><strong>Disclaimer:</strong> This is not an in depth explaination of responsive image solutions.</p>
<p>There are much better resources, many of which are linked to in the resources slide.</p>
<aside class="notes">
Goal here is to roughly understand what we're trying to accomplish through Drupal's GUI.
</aside>
</section>
<!-- img solution -->
<section>
<section id="solution-img">
<h3><code>img</code> tag</h3>
<figure>
<pre><code>
<img src="awesome-photo.jpg" alt="Awesome photo, bro." />
</code></pre>
</figure>
<p>This is required for every solution. Every other technique builds on to HTML's core <code>img</code> tag.
</p>
</section>
</section>
<!-- srcset solution -->
<section>
<section id="solution-srcset">
<h3><code>srcset</code> attribute</h3>
<figure>
<pre><code>
<img srcset="awesome-photo.jpg,
awesome-photo_2x.jpg 2x"
src="awesome-photo.jpg"
alt="Awesome photo, bro.">
</code></pre>
</figure>
<p>Attribute to inform the browser of alternate image sources.</p>
<p class="fragment">Best used when trying to address resolution use cases.</p>
</section>
<section id="solution-srcset-flavors">
<h3><code>srcset</code> attribute</h3>
<p><code>srcset</code> comes in two flavors:</p>
<figure class="fragment">
<pre><code>
<img srcset="awesome-photo.jpg,
awesome-photo_2x.jpg 2x"
src="awesome-photo.jpg"
alt="Awesome photo, bro.">
</code></pre>
<figcaption>Example using density, or X, descriptors</figcaption>
</figure>
<figure class="fragment">
<pre><code>
<img
srcset="quilt_3/large.jpg 1240w,
quilt_3/medium.jpg 620w,
quilt_3/small.jpg 310w"
sizes="(min-width: 41.25em) 38.75em,
calc(100vw - 2.5em)"
src="quilt_3/medium.jpg"
alt="A crazy quilt whose irregular fabric scraps are fit into a lattice of diamonds." />
</code></pre>
<figcaption>Example using width, or W, descriptors<br>Source: <cite><a href="http://alistapart.com/article/responsive-images-in-practice#snippet8">A List Apart</a></cite></figcaption>
</figure>
<aside class="notes">
X descriptors tell the browser this image is suited for specific screen resolutions. This is great for fixed width images. Drupal seems to always default to this. <br>
W descriptors inform the browser of the width of the image sources, then use the sizes attr to provide information about how that image will be displayed.<br>
using that info, browser can pick more appropriate sources.
</aside>
</section>
</section>
<!-- <picture> solution -->
<section>
<section id="solution-picture">
<h3><code>picture</code> element</h3>
<p>New element in HTML5 to define different image sources based on varying criteria.</p>
<div class="fragment">
<p><hr></p>
<p><code>srcset</code> allows the browser to make educated decisions on source.</p>
<p><code>picture</code> dictates to the browser which source we want.</p>
<p>Best when used for art direction or browser support use cases.</p>
</div>
</section>
<section id="solution-picture-markup">
<h3><code>picture</code> element</h3>
<figure>
<pre><code>
<picture>
<source media="(min-width: 900px)" srcset="cat-vertical.jpg">
<source media="(min-width: 750px)" srcset="cat-horizontal.jpg">
<img src="cat.jpg" alt="cat">
</picture>
</code></pre>
<figcaption>Source: <cite><a href="http://blog.cloudfour.com/responsive-images-101-part-6-picture-element/">Cloud Four</a></cite></figcaption>
</figure>
<p><br></p>
<p><strong>Media condition:</strong> stripped down media queries.</p>
<p><strong><code>srcset</code>:</strong> defines the source to use at this condition.</p>
<aside class="notes">
srcset is fully featured. So you can then support resolution switching on your art directed images.
</aside>
</section>
</section>
<!-- Complex problems -->
<section id="complex-problems">
<h3>Complex problems, complex solutions</h3>
<figure>
<pre><code>
<picture>
<!-- 16:9 crop -->
<source
type="image/webp"
media="(min-width: 36em)"
srcset="quilt_2/detail/large.webp 1920w,
quilt_2/detail/medium.webp 960w,
quilt_2/detail/small.webp 480w" />
<source
media="(min-width: 36em)"
srcset="quilt_2/detail/large.jpg 1920w,
quilt_2/detail/medium.jpg 960w,
quilt_2/detail/small.jpg 480w" />
<!-- square crop -->
<source
type="image/webp"
srcset="quilt_2/square/large.webp 822w,
quilt_2/square/medium.webp 640w,
quilt_2/square/small.webp 320w" />
<source
srcset="quilt_2/square/large.jpg 822w,
quilt_2/square/medium.jpg 640w,
quilt_2/square/small.jpg 320w" />
<img
src="quilt_2/detail/medium.jpg"
alt="Detail of the above quilt, highlighting the embroidery and exotic stitchwork." />
</picture>
</code></pre>
<figcaption>Source: <cite><a href="http://alistapart.com/article/responsive-images-in-practice#snippet13">A List Apart</a></cite></figcaption>
</figure>
</section>
<section id="easier-way" data-background="images/easier-way.jpg">
<h3 style="color: #fff;">There is an easier way!</h3>
</section>
<!-- Drupal solutions -->
<section>
<section id="drupal-gains">
<h3>Drupal FTW!</h3>
<p>Drupal has awesome modules to ease a lot of this complexity.</p>
<p><hr></p>
<div style="text-align: left;">
<p class="fragment"><strong>Image Styles:</strong> Create all the different image sizes and crops for us.</p>
<p class="fragment"><strong><a href="https://www.drupal.org/project/breakpoints">Breakpoints</a>:</strong> Allows you to expose site breakpoints to Drupal, and group them by components.</p>
<p class="fragment"><strong><a href="https://www.drupal.org/project/picture">Picture</a>:</strong> Maps image styles to breakpoints. Creates image field formatters for both <code>srcset</code> with <code>sizes</code> and <code>picture</code> element. And it includes <a href="http://scottjehl.github.io/picturefill/">picturefill 2 polyfill</a> for older browser support.</p>
</div>
<aside class="notes">
Image styles: using style guide can pre plan these styles, document them and even import them into drupal to save you a lot of time. <br>
</aside>
</section>
</section>
<!-- demo -->
<section id="demo" data-background="images/demo.gif">
<h3 style="color: #fff;">Demo!</h3>
</section>
<section id="questions">
<h3>Questions?</h3>
<p><hr></p>
<h3>Feedback?</h3>
<p style="font-size: 70%;"><a href="http://bit.ly/riid-dcco15">Session Page</a> | <a href="http://twitter.com/jnettik">Twitter</a></p>
</section>
<!-- resources -->
<section id="resources">
<h3>Resources</h3>
<ul>
<li><a href="http://alistapart.com/article/responsive-images-in-practice">Responsive Images in Practice: Eric Portis</a></li>
<li><a href="http://blog.cloudfour.com/responsive-images-101-definitions/">Responsive Images 101: Jason Grigsby</a></li>
<li><a href="http://thewebahead.net/99">The Web Ahead podcast interview with Jason Grigsby</a></li>
<li><a href="http://codepen.io/Tigt/blog/when-responsive-images-get-ugly">When Responsive Images Get Ugly: Taylor Hunt</a></li>
<li><a href="https://medium.com/@guypod/high-performance-images-beautiful-shouldn-t-mean-slow-22ffc4e31663">High Performance Images: Beautiful Shouldn’t Mean Slow: Guy Podjarny</a></li>
<li><a href="https://www.drupal.org/node/2450863">Option to only use img with srcset: Drupal.org issue</a></li>
</ul>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>