ZGD Posted July 5, 2016 Share Posted July 5, 2016 I've been using PW for a few years now and I believe this is the only problem I frequently encounter, although this latest case is particularly relevant. I'm sure there must be a simple solution, but I've yet to work it out. Thanks to a great collaboration with a member of the community, we have a website (still in development...) that imports data from an external service into PW via a JSON feed. The import process can create hundreds of pages with new images that are saved from URLs specified in the feed. As these can be very high resolution, we use the $image->size() method to resize them to acceptable dimensions. As this import process is happening constantly in the background, images on certain pages are constantly changing. This means a large number of images may not have variants generated until that page is visited by a user, and that process can take quite a while. Some pages have 50+ images (lazyloaded!). What is the normal way of solving this problem? I'd considered writing a module that would imitate a user visit to these pages each time they are saved and thus generate the variants. Is there a simpler solution? Link to comment Share on other sites More sharing options...
LostKobrakai Posted July 5, 2016 Share Posted July 5, 2016 If you only need the images to be created and you know the sizes upfront, then simply call those width functions as part of the import process. $img = … // Create thumbs $img->size(700, 300); $img->width(200); … 2 Link to comment Share on other sites More sharing options...
ZGD Posted July 6, 2016 Author Share Posted July 6, 2016 Thanks LostKobrakai, works perfectly. I'll think about creating a new/modified field for pre-generating variants for future use. Link to comment Share on other sites More sharing options...
LostKobrakai Posted July 6, 2016 Share Posted July 6, 2016 There's already CroppableImage and it's kinda predecessor Thumbnails. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now