How about presets? #202
Replies: 3 comments 9 replies
-
In v3.0.0 I PR'd in extensible dimension calculator #193. In theory, reusing presets could be possible if you return dimensions equal to the ones defined in presets. Make sure you match up all Glide params 1:1. Technically, it is already possible. Your package is still a decent solution to the problem IMO. |
Beta Was this translation helpful? Give feedback.
-
Interesting... I'm probably misunderstanding but does that mean this package could use the Statamic presets defined in config/assets.php, rather than new ones defined in config/responsive-images.php? I'm struggling to see how that would work when using different ratios per breakpoint. |
Beta Was this translation helpful? Give feedback.
-
I messed around with this for a while. I copied the GenerateResponsiveVersionsCommand and made a simple modification:
This requires a new array variable in config/statamic/responsive-images.php. Example:
It works but it takes 3 minutes per image with the single preset as defined above. This particular preset would be the most demanding out of all of them - I wouldn't normally have a different ratio for every breakpoint. Slowness is probably down to the fact that I am running this command locally and the image in question is 1mb on Digital Ocean storage. Glide seems to be re-fetching the image over and over from DO for every single manipulation. There are 144 manipulations produced by this preset. If I had 10 presets likes this then I would imagine it could take 10 minutes per image. I have 1000 images = 166 hours! So this idea doesn't seem feasible without major optimisation on Glide's / Statamic's part, i.e. don't re-retrieve the file for every manipulation. Perhaps I can add a custom job to generate all manipulations at once... 🤔 |
Beta Was this translation helpful? Give feedback.
-
I think it was mentioned before but, are there any plans to add presets to this package? Similar to Statamic's presets
I was thinking that it might solve a lot of errors with image-heavy websites. I'm still using this package to generate images when launching sites and deploying design changes, otherwise my server will crash for hours until all images are manipulated.
Beta Was this translation helpful? Give feedback.
All reactions