Re:Image optimization decreased website's page weight by 62%
by mimischi on Monday July 16, 2018 @11:22AM
(#17541981)
No need to do on-demand scaling via JavaScript either! The srcset attribute is also available in <img> tags and lets you define differently sized images for different viewports: https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimed...
Didn't know you could wrap images in a <picture> tag and browsers (except for IE) will automatically download the .webp version if they support it. Used to do this via a Javascript. I like on-demand scaling where you pass scaling parameters in the url, such as: /200x200/sample_image.jpg.