From eecfdae0b639a1b33e77bbfe03be7360e6d46487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Nadaud?= Date: Wed, 17 Jul 2013 18:23:59 +0200 Subject: [PATCH] [-] BO : FixBug #PSCFV-8217 Shop logo image not refresh after change --- classes/ImageManager.php | 2 +- controllers/admin/AdminStoresController.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/classes/ImageManager.php b/classes/ImageManager.php index c7500c8fd..b29bab40c 100644 --- a/classes/ImageManager.php +++ b/classes/ImageManager.php @@ -76,7 +76,7 @@ class ImageManagerCore } // Relative link will always work, whatever the base uri set in the admin if (Context::getContext()->controller->controller_type == 'admin') - return ''; + return ''; else return ''; } diff --git a/controllers/admin/AdminStoresController.php b/controllers/admin/AdminStoresController.php index 03a001d34..ec9175901 100644 --- a/controllers/admin/AdminStoresController.php +++ b/controllers/admin/AdminStoresController.php @@ -296,8 +296,12 @@ class AdminStoresControllerCore extends AdminController if (!($obj = $this->loadObject(true))) return; + + if (file_exists(_PS_TMP_IMG_DIR_.$this->table.'_'.(int)$obj->id.'.'.$this->imageType)) { + @unlink(_PS_TMP_IMG_DIR_.$this->table.'_'.(int)$obj->id.'.'.$this->imageType); + } - $image = ImageManager::thumbnail(_PS_STORE_IMG_DIR_.'/'.$obj->id.'.jpg', $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350, $this->imageType, true); + $image = ImageManager::thumbnail(_PS_STORE_IMG_DIR_.DIRECTORY_SEPARATOR.$obj->id.'.jpg', $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350, $this->imageType, true, true); $days = array(); $days[1] = $this->l('Monday'); @@ -316,7 +320,7 @@ class AdminStoresControllerCore extends AdminController 'latitude' => $this->getFieldValue($obj, 'latitude') ? $this->getFieldValue($obj, 'latitude') : Configuration::get('PS_STORES_CENTER_LAT'), 'longitude' => $this->getFieldValue($obj, 'longitude') ? $this->getFieldValue($obj, 'longitude') : Configuration::get('PS_STORES_CENTER_LONG'), 'image' => $image ? $image : false, - 'size' => $image ? filesize(_PS_STORE_IMG_DIR_.'/'.$obj->id.'.jpg') / 1000 : false, + 'size' => $image ? filesize(_PS_STORE_IMG_DIR_.DIRECTORY_SEPARATOR.$obj->id.'.jpg') / 1000 : false, 'days' => $days, 'hours' => isset($hours_unserialized) ? $hours_unserialized : false );