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

High-performance images in WordPress

keithdevon
September 25, 2019

High-performance images in WordPress

The web is full of big beautiful images these days. They look great but they can come at a HUGE cost for performance. If your images aren’t optimised properly your websites speed will suffer, and that means higher bounce rates, lower conversion rates, poor engagement, and worse.

In this talk, we’ll explore all of the techniques at our disposal for optimising images to make your site way faster. We'll cover image formats and sizes, optimization tools, responsive images, and exciting new opportunities.

keithdevon

September 25, 2019
Tweet

More Decks by keithdevon

Other Decks in Programming

Transcript

  1. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    What we’ll cover • Image optimisation overview • Number of images • Image style • Compression • Image formats • Image dimensions • Viewports, screens, resolutions and pixels • Responsive images • Lazy loading • Browser caching • Image CDNs • Image optimisation demo • Summary
  2. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Hi! I’m Keith @keithdevon https:/ /highrise.digital @highrisedigital
  3. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Why care about web performance? • Accessibility • Conversion optimisation • SEO • Hosting costs • The environment
  4. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Median kilobytes Desktop Mobile Total page weight 1,937 KB 1,748 KB Image bytes 987 KB 897 KB Image % 51% 51%
  5. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Image optimisation factors • Number of images • Image style • Compression • File type/format • Physical dimensions • Responsive images • Lazy loading • Browser caching • CDNs
  6. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Compression types Lossless • No loss of visual quality • Removal of metadata • Small file size changes Lossy • Varying loss of visual quality • Choice of quality setting • Potential large file size savings
  7. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Bonus: Using CSS3 1.5 MB 1.3 MB CSS gradient 0.76 MB + =
  8. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Vector • Created using mathematical instructions • SVG format • Can scale and zoom perfectly • Use for simple geometric shapes • Can be manipulated with CSS and JS
  9. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Raster • Grid of pixels (bitmap) • JPEG, PNG, GIF formats • Don’t scale and zoom • Use for complex images and photos
  10. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    GIF ❌ Rich imagery ✅ Transparency ✅ Animation
  11. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    JPEG Quality setting 100% - 123 KB 75% - 27 KB 50% - 15 KB 25% - 8 KB
  12. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Browser-specific image formats • WebP • JPEG XR • JPEG 2000
  13. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Image format summary • Use vector formats for simple geometric shapes that scale. • Use JPEG for photos and complex images • Use PNGs for transparency • Don’t use GIFs!
  14. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    A quick refresher on viewports, screens, resolutions and pixels
  15. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    iPhone X pixel dimensions Physical pixels CSS pixels 1 CSS pixel equals 9 physical pixels
  16. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    WordPress image sizes • Thumbnail - 150px - hard cropped
 • Medium - 300px
 • Medium-large - 768px
 • Large - 1024px
 • Full - original uploaded file
  17. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    https:/ /kinsta.com/blog/wordpress-lazy-load/
  18. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    WordPress image performance plugins • Imagify Image Optimizer • Imsanity • ShortPixel Image Optimizer • Optimole • EWWW Image Optimizer Cloud • WP Smush • TingPNG • ImageRecycle
  19. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Apache image caching Cache-control headers Expires headers Add these to your .htaccess file
  20. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Nginx image caching Cache-control headers Expires headers Add these to your server config’s server location or block
  21. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Image CDNs • Reduce server load • Reduce latency • Compression • Cropping • Resizing • Modern image formats • Do all this on the fly
  22. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    CDNs • Cloudflare • Fastly • KeyCDN • MetaCDN • StackPath • etc.
  23. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Image CDNs • KeyCDN • Sirv • Cloudinary • etc.
  24. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Summary • Web performance is important • Images are a huge part of that! • Optimise your image files • Optimise image delivery • Experiment and learn
  25. High-Performance Images in WordPress - WordSesh EMEA 2019 - @keithdevon

    Thanks for joining me! @keithdevon @highrisedigital