Maybe this should still be considered:
At he beginning:
if (preg_match('/\/img\/(p|c|m|s|st)\/(\d+\/)*\d+\.(jpg|jpeg|png|gif)$/Us', $destinationFile)) { return @copy($sourceFile, $destinationFile); }
From here: https://www.sunnytoo.com/42096/an-important-fix-to-optimize-prestashops-image-upload-function
To keep the original image as it was. For further possible optimization in the future