Description
Improvement description
We found a problem with the image optimisation algorithm.
I one project we had 330G images in the folder "var/tmp" witch are from the image optimisation.
The problem is that there was an huge tiff file. For that file there was a thumbnail with ~10M.
The optimizer "pngout" run very long for that image an run into a timeout (witch is 60s default from the symfony process component).
We also found many temp files in many other projects, with much smaller thumbnails.
I think there could be 2 things to avoid such a huge amount of temp files.
First in the Pimcore\Image\Optimizer\AbstractCommandOptimizer
the symfony process should be initialized with an configurable timeout value which defaults to 60s.
The second thing is that there is a random file generated for the optimisation process.
When an exception occurs like symfony process timeout the whole process stops an the ramdon file is still there.
I think there should be a try catch arround of the complete optimisation for example in Pimcore\Image\Optimizer::optimizeImage
.
When an Error or an Exception occurs, the temp file should be deleted.