How do i generate (way) less variations? #254
-
It's way too memory intensive to generate 15-30 variations per image, not to mention a huge amount of storage space. How can I generate let's say 3-5 variations MAX? Is this possible? I've been trying to figure this out for hours and all I'm running into is server crashes and am honestly at my wits end trying to make this work for a new Starter Kit we're launching. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Hi Jack, it's been a while I have developed for Statamic and this package, but quite some time ago I implemented a change that allows for the dimension calculations to be overridden. #193 This should allow you to cut down on the variants produced. You would have to bind your own |
Beta Was this translation helpful? Give feedback.
-
One thing you can do is set the max width config, which will give an upper limit to the image sizes being generated. We also don't advise using glide image caching in combination with this addon, as it generates all the variations upfront, turning it off will only generate the variations that are necessary (usually optimized for the most common screen sizes) A final thing you can do if you really only want a few sizes, is to implement your own |
Beta Was this translation helpful? Give feedback.
@jackmcdade I've just added the threshold for the default DimensionCalculator to the config file: https://github.com/spatie/statamic-responsive-images/blob/main/config/responsive-images.php#L76
Setting this lower will result in less variants being generated. You'll need to update to the latest version for this