1

Is there any way to serve scaled images?

Specially, when images are already uploaded like product images or some CMS page images.

I'm not looking for some solution that will scale images one-by-one. I need something that can scale uploaded images automatically.

I'm working on speed optimization and want to improve serve scaled images score.

2

There is a great answer by @Konstantin Gerasimov regarding this.

You can read it here - How to optimize images in Magento or check out the same in quote.

**Here are 3 approaches to image optimization for magento or any other site for that matter:

1. Command line You will need command line tools: [gifsicle][1], [jpegtran][2] and [optipng][3]. Your hosting might probably have it already you just need to check. Once installed use the following bash script to optimize images: #!/bin/bash find ./media -iname '.gif' -exec sh -c ‘gifsicle -b -O3 -o "{}.out" "{}"; mv "{}.out" "{}"' \; find ./media -iname '.png' -exec optipng -o5 -keep -preserve '{}' \; find ./media -type f -iname '*jpg' -exec sh -c 'jpegtran -outfile "{}.out" -optimize "{}"; mv "{}.out" "{}"' \; Run it from magento root folder. It will optimize all your images automatically.

2. Google PageSpeed Module Google & Co developed this great web server extension [Google PageSpeed Module][4]. It might be a little difficult to install and configure but once setup it will optimize your images on the fly. Here is [apache packages][5] for you to download and install.

3. Google PageSpeed Insights This one involves some manual work. Go to [Google PageSpeed Insights][6] and run your page through it. Once completed you can download your optimized images (the link will be at the bottom). Repeat this step for your main pages. Originally published by me as [Image Optimization in 3 easy steps][7]. For me the command line approach is the best one. UPDATE: For more speed optimization tips take a look at these [20 proven steps][8]. [1]: https://www.lcdf.org/gifsicle/ [2]: http://jpegclub.org/jpegtran/ [3]: http://optipng.sourceforge.net/
[4]: https://developers.google.com/speed/pagespeed/module/ [5]: https://modpagespeed.com/doc/download [6]: https://developers.google.com/speed/pagespeed/insights/ [7]: https://www.goivvy.com/blog/image-optimization-3-easy-steps [8]: https://www.goivvy.com/blog/magento-speed-boost**

0

We suggest install Google PageSpeed module too.

In our case, it automatically resize and optimize images + convert some images to .webp format or insert inline (data-uri) for small images.

Our configuration (nginx + varnish + pagespeed + phpfpm) with applicable filters (for Magento 2): https://mirasvit.com/blog/how-to-turbocharge-magento-2-store-with-google-pagespeed-module.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.