I understand, so basically you would use the tasks.php plugin as referenced earlier in this post. You would basically trigger it at night (or whenever), and just set the timeout to something very high like 21600
(6 hours). This will allow it to process as much as possible when not used, and if it is triggered when most thumbnails are already created, it will only process non-created thumbnails anyway.
Then, if you want to setup this as an automated task every night, you would probably need to use some CRON job.
I can't imagine any better or more logical way to deal with on your side.
Of course, as soon as you upload images, it will try to create resized images immediately after upload. How would you prefer this to work? You want resize disabled by default and after uploading images? That would of course mean that you can't view thumbnails for the images you upload, until they are processed by tasks later on. A simple workaround would be to be in LIST view mode when uploading, so the thumbnails never get requested.
luis I have no problem with the limits of the hardware I am using, I am aware of its limits.
😃 I never questioned your hardware. We both know that heavy tasks, like creating loads of resized images, will only be able to process at maximum processing power.
luis if I upload +1000 images and then I enter in the folder via the browser, the fact that the cache is triggered is consuming all the ram and cpu available.
Yes I understand. How about disabling image_resize_enabled
altogether? This would mean it would attempt to load the original images as thumbnails, without any resizing on server. This could work, but not if your images are typically massive 2000+ px, as that would be too heavy to load into browser. Alternatively, you could modify the load_images_max_filesize
to toggle how large images can be loaded into the layout, in which case icons will display instead of large images. The icons can be clicked of course, displaying original images in the popup.
The only other option if you want resized images, would be to 1. disable resized images before upload, 2. process thumbnails at any time with tasks, 3. re-enable resized images when they have been created. In this case, naturally you will never be able to see thumbnails after upload, until they are processed.
I can't really think of any better solution. I think what you are looking for, is something like this "If image is already cached, please load it. If not, ignore resizing and show icon instead.". Am I correct?
luis In order to get that functionality, my comment was more oriented to manually trigger the generation of the cache via custom http request so I can schedule it at night
The tasks.php plugin referenced earlier in this post does exactly that.
luis My main idea is to stop or limit the cache generation after an amount of time or files so by 8am, the cache generation process should be stopped and it won't impact on the other services running. That's my idea. I am not sure if I get the "timeout" concept you are referring to, I assume it is about an "execution time" or similar.
Yes, basically execution time. tasks.php?timeout=21600
will run the script in browser for 6 hours, in which case it will fail and return timeout
in browser. By that time, it has created a lot of thumbnails of course, or even all. With timeout, you know when it will start and stop. Of course, if it creates remaining thumbnails before the timeout duration, it will end before.