Lorti / dominant-colors-lazy-loading-wordpress-plugin

This plugin allows you to lazy load your images while showing the dominant color of each image as a placeholder – like Pinterest or Google Images.
https://wordpress.org/plugins/dominant-colors-lazy-loading/
GNU General Public License v2.0
95 stars 10 forks source link

Generating and storing unnecessary data #25

Open curtchan opened 5 years ago

curtchan commented 5 years ago

Analyzed whole thumbnail generating flow.

I'd suggest, instead of generating 4 thumbnails - generating only one + storing type of it.

If user changes in config thumbnail type - notify that images require regenerating.

It should speed up whole generating process and limit DB usage.

Lorti commented 5 years ago

I personally don't mind the few extra bytes, and WordPress itself is very generous when it comes to storing images. Also you don't have to wait for regeneration of all your images when switching to a different placeholder style.

I do understand that there's a lot of data created, especially on image-heavy sites or large blogs, but I have a feeling that there are other areas for optimization, with a larger lever.

curtchan commented 5 years ago

Well, i'm always looking at such things from optimization point of view, keeping in mind that some websites i deal with have thousands of images, iterating through each and instantiating 4 Imagick objects (and operating on them) will definitely take longer than doing same just once if needed, would have to stress-test it though to see if the difference is worth rewriting it.

https://github.com/Lorti/dominant-colors-lazy-loading-wordpress-plugin/blob/da7f78916b89d8c72e0ddb4b9287950fd50e2aae/admin/class-dominant-colors-lazy-loading-admin.php#L363

Lorti commented 5 years ago

I’m also using the plugin on a page with thousands of images. The regeneration was only necessary once at the beginning. When uploading new pictures the dominant color calculation and thumbnail generation isn’t noticeable. If I ever want to switch to a different placeholder style it happens instantaneously.

Your suggestion is worth looking into, but I personally don’t have the time for it right now. I'd be happy if you or the community wants to take this on ;)