236
Responsive Images Picture and Drupal, best friends forever Friday, July 19, 13

Responsive Images and Drupal: Twin Cities Drupal Camp 2013

  • View
    14

  • Download
    3

Embed Size (px)

DESCRIPTION

Video of this talk: http://www.youtube.com/watch?v=Zo_TTvV6DC4 One of the challenges posed by fluid, responsive designs is how to provide quality images that download quickly. We’ll look at the challenges at finding a good solution, and the problems with some of the solutions available. The primary solution we will look at is the proposed picture element, which allows us to provide several images at various sizes and resolutions, with the appropriate image selected with media queries. We will also examine how to determine the sizes for the images you use in the picture element and touch on how to make video appear at the correct aspect ratio no matter the size of its container, using padding. Most importantly, we’ll look at options for how to implement responsive images in Drupal, particularly through the Picture and Breakpoint modules. We’ll also look at ways to use responsive images in conjunction with fields, Views and WYSIWYG editors.

Citation preview

Page 1: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Responsive ImagesPicture and Drupal, best friends forever

Friday, July 19, 13

Page 2: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Marc Drummond

Drupal: mdrummondTwitter: @MarcDrummondBlog: www.marcdrummond.com

Find me:

Web and graphic design, City of Minnetonka

Friday, July 19, 13

Page 3: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

34%Friday, July 19, 13

Page 4: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

72%Friday, July 19, 13

Page 5: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Step OneFlexible Images

Friday, July 19, 13

Page 6: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Responsive Web DesignEthan Marcotte

Friday, July 19, 13

Page 7: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Three ingredientsFluid gridsMedia queriesFlexible images

Friday, July 19, 13

Page 8: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

New devicesFriday, July 19, 13

Page 9: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

DifferentScreen sizesResolutionsBrowser capabilities

Friday, July 19, 13

Page 10: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

DevicesSmartphonesTabletsLaptopsDesktopsTVXbox and Wii

Friday, July 19, 13

Page 11: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Difficulty over time

0

25

50

75

100

2007 2009 2011 2013

Frustration

Friday, July 19, 13

Page 12: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Responsive Design(Sanity)

Friday, July 19, 13

Page 13: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

FluidFriday, July 19, 13

Page 14: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

StretchedFriday, July 19, 13

Page 15: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

ScrunchedFriday, July 19, 13

Page 16: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

The Giants win the pennant! The Giants win the pennant! The Giants win the pennant!

The Giants win the pennant!

The Giants win the pennant!

The Giants win the pennant!

Friday, July 19, 13

Page 17: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Responsive solutionMultiple fluid layouts

Friday, July 19, 13

Page 18: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Grids, baby!Friday, July 19, 13

Page 19: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

AlignmentFriday, July 19, 13

Page 20: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

960.gsFriday, July 19, 13

Page 21: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Multiple grids, baby!Friday, July 19, 13

Page 22: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

New toolsZen GridsGridsetSass with Compass

Friday, July 19, 13

Page 23: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Media Queries&

Breakpoints

Friday, July 19, 13

Page 24: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Viewport&

Resolution

Friday, July 19, 13

Page 25: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Device breakpoints are broken

Friday, July 19, 13

Page 26: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

"The absence of support for media queries is in fact the first media query."

–Bryan Rieger

Friday, July 19, 13

Page 27: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

@media  screen  and  (min-­‐width:  300px)  {   /*  STYLES  HERE  */}

Friday, July 19, 13

Page 28: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

@media  screen  and  (min-­‐width:  300px)  {   /*  STYLES  HERE  */}

@media  screen  and  (min-­‐width:  472px)  {   /*  STYLES  HERE  */}

Friday, July 19, 13

Page 29: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

@media  screen  and  (min-­‐width:  18.75em)  {   /*  STYLES  HERE  */}

@media  screen  and  (min-­‐width:  29.5em)  {   /*  STYLES  HERE  */}

Friday, July 19, 13

Page 30: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Accessibility&

Kindles

Friday, July 19, 13

Page 31: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Future Friendly

Friday, July 19, 13

Page 32: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Something doesn't fitFriday, July 19, 13

Page 33: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

HierarchyFriday, July 19, 13

Page 34: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Fun reminderFluid gridsMedia queriesFlexible images

Friday, July 19, 13

Page 35: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

img { width: 100%;}

Friday, July 19, 13

Page 36: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Oops.

Friday, July 19, 13

Page 37: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

DownscaleFriday, July 19, 13

Page 38: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

UpscaleFriday, July 19, 13

Page 39: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

img { max-width: 100%;}

Friday, July 19, 13

Page 40: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

img { max-width: 100%; height: auto;}

Friday, July 19, 13

Page 41: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

img { width: 100%; max-width: 100%; height: auto;}

Friday, July 19, 13

Page 42: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Let's go halfsies

Friday, July 19, 13

Page 43: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

figure { width: 50%;}

Friday, July 19, 13

Page 44: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Use the Grid, Luke!

Friday, July 19, 13

Page 45: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

What about... YouTube?

Friday, July 19, 13

Page 46: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

video,iframe,object { max-width: 100%;}

Friday, July 19, 13

Page 47: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Stupid aspect ratio

Friday, July 19, 13

Page 48: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

.ratio-4-3 { height: 0; padding-bottom: 75%;}

Friday, July 19, 13

Page 49: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

.ratio-16-9 { height: 0; padding-bottom: 56.25%;}

Friday, July 19, 13

Page 50: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Get your popcorn!Friday, July 19, 13

Page 51: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Congratulations on your success. I guess.

Friday, July 19, 13

Page 52: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Just a secondof your time

Friday, July 19, 13

Page 53: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Retina (graphics)Friday, July 19, 13

Page 54: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

200x200400x4002 x 2 = 4 times as large

Friday, July 19, 13

Page 55: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Tightly packed pixelsFriday, July 19, 13

Page 56: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Curse you, blurry upscaling!

Friday, July 19, 13

Page 57: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

High res all the

things!

Friday, July 19, 13

Page 58: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

HOLD UP

Friday, July 19, 13

Page 59: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

iHuge

Friday, July 19, 13

Page 60: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

3888x2592WAT?!

Friday, July 19, 13

Page 61: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Livin' on the EDGEFriday, July 19, 13

Page 62: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

3888/640 = 6x6w x 6h = 36x

Ouch

Friday, July 19, 13

Page 63: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

3888/320 = 12x12w x 12h = 144x

I hate you forever.

Friday, July 19, 13

Page 64: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Wasteful. Slow. Ridiculous.

Friday, July 19, 13

Page 65: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Fancy

Friday, July 19, 13

Page 66: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

97%Friday, July 19, 13

Page 67: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

I give upFriday, July 19, 13

Page 68: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Why?Friday, July 19, 13

Page 69: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 70: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 71: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 72: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 73: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 74: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 75: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 76: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 77: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Don't.Give.Up.

Friday, July 19, 13

Page 78: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Step TwoResponsible images

Friday, July 19, 13

Page 79: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Just enough image.

No more.

Friday, July 19, 13

Page 80: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

QuickFriday, July 19, 13

Page 81: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

EfficientFriday, July 19, 13

Page 82: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Go forthFriday, July 19, 13

Page 83: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 84: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Confession time

Browsers are

difficultFriday, July 19, 13

Page 85: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Browser to-do listEat breakfastDrive to workTime to frustrate developers!

Friday, July 19, 13

Page 86: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Download all the things

Friday, July 19, 13

Page 87: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Parse-lyFriday, July 19, 13

Page 88: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

PaintFriday, July 19, 13

Page 89: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

I'll get to ya', bubFriday, July 19, 13

Page 90: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

LookaheadFriday, July 19, 13

Page 91: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

99 problems

Lookahead #1

Friday, July 19, 13

Page 92: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 93: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

20%Friday, July 19, 13

Page 94: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Need for speed

Friday, July 19, 13

Page 95: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

0

25

50

75

100

That guy The other guy Us

Awesomeness

Friday, July 19, 13

Page 96: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

0

75

150

225

300

That guy The other guy Us

Bandwidth

Friday, July 19, 13

Page 97: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

0

37.5

75

112.5

150

That guy The other guy Us

Image quality

Friday, July 19, 13

Page 98: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

0

3.75

7.5

11.25

15

That guy The other guy Us

SPEEEEEED

Friday, July 19, 13

Page 99: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 100: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Let's talk radiosFriday, July 19, 13

Page 101: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Window of opportunity

Friday, July 19, 13

Page 102: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Battery drainFriday, July 19, 13

Page 103: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Hit meFriday, July 19, 13

Page 104: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

ThreadsFriday, July 19, 13

Page 105: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Concatenate

Friday, July 19, 13

Page 106: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Sprites

Friday, July 19, 13

Page 107: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Three dragonsFriday, July 19, 13

Page 108: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Browser challengesLookahead preloaderRadio load timeLatency from server hits

Friday, July 19, 13

Page 109: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

CerberusFriday, July 19, 13

Page 110: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Solutions with problemsThe things we tried

Friday, July 19, 13

Page 111: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Fallen warriorsFriday, July 19, 13

Page 112: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Let's try Javascript

Friday, July 19, 13

Page 113: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Javascript SwitchFriday, July 19, 13

Page 114: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Too late

Friday, July 19, 13

Page 115: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Fast browsersFriday, July 19, 13

Page 116: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

MultiplicityFriday, July 19, 13

Page 117: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

CookiesFriday, July 19, 13

Page 118: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Fast as fast can be,you'll never catch me!

Friday, July 19, 13

Page 119: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Rotate 90 degrees

Friday, July 19, 13

Page 120: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

CDN CachesFriday, July 19, 13

Page 121: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

<noscript>Friday, July 19, 13

Page 122: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

No prefetching

:(

Friday, July 19, 13

Page 123: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

No Javascript?Friday, July 19, 13

Page 124: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

On demand

Friday, July 19, 13

Page 125: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

ScrollingScrollingScrolling

Friday, July 19, 13

Page 126: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Sad radio.Sad battery.

:(Friday, July 19, 13

Page 127: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Element query nirvana

Friday, July 19, 13

Page 128: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

In theory great...

Friday, July 19, 13

Page 129: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Preloader has a sad

:(Friday, July 19, 13

Page 130: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

speed vs size

Friday, July 19, 13

Page 131: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Problems with solutions

Tools that work

Friday, July 19, 13

Page 132: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Arm thyselfFriday, July 19, 13

Page 133: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Our top goalsBeautiful QuickEfficient

Friday, July 19, 13

Page 134: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

One way to winFriday, July 19, 13

Page 135: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

CSS3Friday, July 19, 13

Page 136: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Which is better?Friday, July 19, 13

Page 137: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

CSS PIEFriday, July 19, 13

Page 138: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Latency and delaysFriday, July 19, 13

Page 139: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

TypeFriday, July 19, 13

Page 140: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Web fontsTypeKit Google fontsFont Squirrel

Friday, July 19, 13

Page 141: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Overhead?

Friday, July 19, 13

Page 142: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

UnicodeFriday, July 19, 13

Page 143: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Icon fonts

Friday, July 19, 13

Page 144: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

T W I T T E R

Friday, July 19, 13

Page 145: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

SVGFriday, July 19, 13

Page 146: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Scalable Vector Graphics

Simple Vector Graphics

Friday, July 19, 13

Page 147: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

GrumpiconFriday, July 19, 13

Page 148: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Cheat codes

Friday, July 19, 13

Page 149: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Raster-farian optionsI was tired when I came up with this headline

Friday, July 19, 13

Page 150: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Optimize first!

Friday, July 19, 13

Page 151: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Quality slider

Friday, July 19, 13

Page 152: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Background images

Friday, July 19, 13

Page 153: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

div { background:url(fun.gif); background-size: 100% 100%; no-repeat; width: 50%;}

Friday, July 19, 13

Page 154: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Contain your

enthusiasmFriday, July 19, 13

Page 155: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

These caveats are on

backgroundFriday, July 19, 13

Page 156: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Alt for screen readers

Friday, July 19, 13

Page 157: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Back to video

Friday, July 19, 13

Page 158: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

<video>      <source  src="mySmallVideo.webm"              type="video/webm"             media="all  and  (max-­‐width:40em)">      <source  src="myVideo.webm"              type="video/webm"></video>

Friday, July 19, 13

Page 159: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Get started(And use fallbacks)

Friday, July 19, 13

Page 160: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Waaaaaaait a minute

Friday, July 19, 13

Page 161: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

<picture alt=""> <source media="(min-width: 45em)" src="big.jpg"> <source media="(min-width: 18em)" src="small.jpg"> <source src="mobile.jpg"> <noscript><img src="mobile.jpg"></noscript></picture>

Friday, July 19, 13

Page 162: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

<picture>

Friday, July 19, 13

Page 163: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 164: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

<picture alt=""> <source media="(min-width: 45em)" src="big.jpg"> <source media="(min-width: 18em)" src="small.jpg"> <source src="mobile.jpg"> <noscript><img src="mobile.jpg"></noscript></picture>

Friday, July 19, 13

Page 165: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

WHATWGWeb Hypertext Application Technology

Working Group

Friday, July 19, 13

Page 166: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

<img src=”fun.jpg” srcset=”fun-HD.jpg 2x, fun-phone.jpg 100w, fun-phone-HD.jpg 100w 2x”>

Friday, July 19, 13

Page 167: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

<picture alt=""> <source media=”(min-width: 45em)” srcset=”big.jpg , big-hd.jpg 2x”>

<source media=”(min-width: 18em)” srcset=”small.jpg , small-hd.jpg 2x”>

<source srcset=”mobile.jpg , mobile-hd.jpg 2x”>

<img src=”mobile.jpg”>

</picture>

Friday, July 19, 13

Page 168: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Browser discretion for bandwidth

Friday, July 19, 13

Page 169: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Art directionFriday, July 19, 13

Page 170: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

W3C StatusFirst public working draft

Friday, July 19, 13

Page 171: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

 <span  data-­‐picture  data-­‐alt="A  giant  stone  face  at  The  Bayon  temple  in  Angkor  Thom,  Cambodia">                <span  data-­‐src="small.jpg"></div>                <span  data-­‐src="medium.jpg"          data-­‐media="(min-­‐width:  400px)"></div>                <span  data-­‐src="large.jpg"            data-­‐media="(min-­‐width:  800px)"></div>                <span  data-­‐src="extralarge.jpg"  data-­‐media="(min-­‐width:  1000px)"></div>

               <!-­‐-­‐  Fallback  content  for  non-­‐JS  browsers.  Same  img  src  as  the  initial,  unqualified  source  element.  -­‐-­‐>                <noscript>                        <img  src="external/imgs/small.jpg"  alt="A  giant  stone  face  at  The  Bayon  temple  in  Angkor  Thom,  Cambodia">                </noscript>        </span>

Picturefill

Friday, July 19, 13

Page 172: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Other options

Friday, July 19, 13

Page 173: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Compressive imagesFriday, July 19, 13

Page 174: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Clown carFriday, July 19, 13

Page 175: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

New image format?

Friday, July 19, 13

Page 176: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Picking <picture>

Friday, July 19, 13

Page 177: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Using picturePicking the right image size for each breakpoint

Friday, July 19, 13

Page 178: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Single column?

Friday, July 19, 13

Page 179: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

ContainersFriday, July 19, 13

Page 180: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Name your breakpoints

Friday, July 19, 13

Page 181: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Container size by breakpointMobile vertical: 1 unit (100%) Mobile landscape: 2 units (100%)Tablet vertical: 5 units (60%)Tablet landscape: 9 units (66.67%)

Friday, July 19, 13

Page 182: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Min & Max

Friday, July 19, 13

Page 183: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Range for a breakpointMobile landscape: 25emTablet vertical: 35em

Friday, July 19, 13

Page 184: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Range in pixels (1em =16px)Mobile landscape: 400pxTablet vertical: 560px

Friday, July 19, 13

Page 185: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Mobile landscape images (100% width)

Minimum: 400pxMaximum: 560px

Friday, July 19, 13

Page 186: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Tablet vertical breakpointsMinimum: 35em (560px)Maximum: 50em (800px)

Friday, July 19, 13

Page 187: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Tablet vertical images (60% width)

Minimum: 336px (60% of 560px)Maximum: 480px (60% of 800px)

Friday, July 19, 13

Page 188: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

How big a range?

Friday, July 19, 13

Page 189: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Downscaling from max-width

Friday, July 19, 13

Page 190: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

560px/400px

40% x 40%

1.4 x 1.4 = 96%Friday, July 19, 13

Page 191: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Mobile landscape images (100% width)

Minimum: 400pxMaximum: 560px

Friday, July 19, 13

Page 192: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Big list of image sizes24032045640855270384011281416

Friday, July 19, 13

Page 193: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Consolidate your list700725750

Friday, July 19, 13

Page 194: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Big list of retina sizes48064091281611041406168022562832

Friday, July 19, 13

Page 195: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

To infinity, and beyond!

Friday, July 19, 13

Page 196: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Striking a balance

Friday, July 19, 13

Page 197: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Rinse and repeat

Friday, July 19, 13

Page 198: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Yes, it's worth it

Friday, July 19, 13

Page 199: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Step threeHow Drupal can help

Using breakpoint, picture, image styles and more

Friday, July 19, 13

Page 200: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Built into Drupal 8

Friday, July 19, 13

Page 201: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Site editors will thank you

Friday, July 19, 13

Page 202: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Drupal 7? Yup!

Friday, July 19, 13

Page 203: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Modules you need for D7PictureBreakpointCtools

Friday, July 19, 13

Page 204: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Set breakpoints

Friday, July 19, 13

Page 205: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Set breakpoints in .infobreakpoints[mobilevert]  =  (min-­‐width:  0)breakpoints[mobileland]  =  (min-­‐width:  25em)breakpoints[mobilelandmid]  =  (min-­‐width:  30em)breakpoints[mobiletabvert]  =  (min-­‐width:  35em)

Etc.

Friday, July 19, 13

Page 206: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Wax on, wax off

Friday, July 19, 13

Page 207: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Breakpoints module

Friday, July 19, 13

Page 208: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Breakpoint groups

Friday, July 19, 13

Page 209: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 210: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 211: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

High-res sources?

Friday, July 19, 13

Page 212: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Auto-generate image styles

Friday, July 19, 13

Page 213: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 214: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Configureimage styles

Friday, July 19, 13

Page 215: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 216: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Matchimage styles

to breakpoints

Friday, July 19, 13

Page 217: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 218: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Displaying picture elements

with fields

Friday, July 19, 13

Page 219: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 220: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Voila!Friday, July 19, 13

Page 221: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Displaying picture elements

with views

Friday, July 19, 13

Page 222: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 223: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 224: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 225: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 226: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

FlexibilityFriday, July 19, 13

Page 227: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Adding imagesto your

content area

Friday, July 19, 13

Page 228: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

IMCE helps

Friday, July 19, 13

Page 229: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Configuration time!

Friday, July 19, 13

Page 230: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Friday, July 19, 13

Page 231: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Text filters

Friday, July 19, 13

Page 232: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Plugin WYSIWYG

Friday, July 19, 13

Page 233: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Add an image

Friday, July 19, 13

Page 234: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

WYSIWYG CSS

Friday, July 19, 13

Page 235: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Everybody clap your hands

Friday, July 19, 13

Page 236: Responsive Images and Drupal: Twin Cities Drupal Camp 2013

Questions?Drupal: mdrummondTwitter: @MarcDrummondBlog: www.marcdrummond.com

Find me:

Friday, July 19, 13