From 279cb99a4e3474567c7bb3075993ce88b7aacf6d Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Thu, 24 Oct 2013 18:52:10 +0200 Subject: [PATCH] // Add regenerate option to thumbnail creation --- classes/ImageManager.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/classes/ImageManager.php b/classes/ImageManager.php index c647b6ea3..c55224e72 100644 --- a/classes/ImageManager.php +++ b/classes/ImageManager.php @@ -39,13 +39,18 @@ class ImageManagerCore * @param int $size Desired size * @param string $image_type Image type * @param bool $disable_cache When turned on a timestamp will be added to the image URI to disable the HTTP cache + * @param bool $regenerate When turned on and the file already exist, the file will be regenerated * @return string */ - public static function thumbnail($image, $cache_image, $size, $image_type = 'jpg', $disable_cache = false) + public static function thumbnail($image, $cache_image, $size, $image_type = 'jpg', $disable_cache = false, + $regenerate = false) { if (!file_exists($image)) return ''; + if (file_exists(_PS_TMP_IMG_DIR_.$cache_image) && $regenerate) + unlink(_PS_TMP_IMG_DIR_.$cache_image); + if (!file_exists(_PS_TMP_IMG_DIR_.$cache_image)) { $infos = getimagesize($image);