Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Generating Simple Responsive Images

Generating Simple Responsive Images

Images are becoming more and more complex on the web. We want to have great looking images but keep file sizes to a minimum especially on mobile devices. Take a look at one simple and effective way to server up images that automatically are the right size for the device you're using.

Tom Hickey

June 17, 2015
Tweet

Other Decks in Programming

Transcript

  1. About me • Coding PHP since the turn of the

    century • Work for danetti.com as the developer and everything else • Unapologetic Apple fanboy • Disney enthusiast
  2. The internet has changed • The good old days websites

    used to be designed to work at 1024x768 • Now devices can be as small as a watch or as large as a building. • The solution is responsive web design!
  3. Responsive websites A website is responsive when the the same

    information and and functionality works on every device
  4. Bitmaps baby! • Vectors are easy to scale, look good

    and small file size • Bitmaps (jpg/png/etc) don’t scale down well and scale upwards terribly. Original Scaled Up
  5. Responsive images • Having a different image served to the

    user depending on the width of the element that it’s contained in • Having a different image served to the user depending on the screen resolution (DPI not HxW) • Having a different image served to the user depending on the connectivity speed of the device
  6. Problems I had in the past • Didn’t keep original

    source images handy • Generating new image for different sizes was a real pain • Re-compress images or trying out new image formats would mean re-uploading the entire library by hand.
  7. Which direction • Crop image to the size you want

    AKA art direction - hard • Scale the image to the size you want AKA scaling - easy
  8. So that was fun, now what • <picture> tag •

    http://caniuse.com/#search=picture • Javascript solutions • http://etiennetalbot.github.io/responsImg/
  9. Notes • More on art direction images -https://css-tricks.com/ which-responsive-images-solution-should-you-use/ •

    Commercial example of this - https://www.resrc.it/ • Better image formats than jpg/png - WebP and BGP
  10. Yay it’s over! • @thickey on twitter • [email protected] on

    email • Github - https://github.com/thickey256/php-smart-image • Feedback on joind.in https://joind.in/14624 • www.danetti.com - use code TomTalk get 15% off any orders until 2015-07-17