sal0max / grav-plugin-shortcode-gallery-plusplus

A Shortcode extension to add sweet galleries with a lightbox to your Grav website.
MIT License
33 stars 8 forks source link

Simple solution for page loading optimization #16

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hello ! ^^ First of all, thank you very much for this plugin. It's very useful ! I propose you here a solution to optimize page loading by reducing images sizes when they are used as thumbnails. The main "algorithm" is in gallery-plusplus.html.twig file : If the image is not modified by the user (With image actions) it can be found in the /user directory. So we can manipulate this object to reduce the size of the image. With this solution, the image is still at full size when we open it on the UI. I'm sorry if this explanation isn't very clear, my english is far from being perfect. Anyway... Thank you for reading this, and have a nice day !

sal0max commented 2 years ago

Exceptional work! Really great stuff! Thanks a lot! Will merge this and release an update, soon. 🙂

ghost commented 2 years ago

You're welcome, and thank you very much, I'm glad you like it. ^^ The only limit is that it cannot optimize images that are not in the /user directory. There is maybe something to do with the Grav API, maybe by creating manually image objects, but the documentation is so weak that I didn't find how to. But these are very special cases. 😁 Have a nice day ! ^^