From 54080062f7b92a77c57aed5d60eae72cc97209ed Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Mon, 13 Feb 2012 15:35:05 +0000 Subject: [PATCH] // Finish removing the "id_theme in ImageType" code git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13265 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/Image.php | 10 ++++------ controllers/admin/AdminCategoriesController.php | 4 ++-- controllers/admin/AdminImportController.php | 3 +-- controllers/admin/AdminLanguagesController.php | 7 +++---- controllers/admin/AdminManufacturersController.php | 3 +-- controllers/admin/AdminProductsController.php | 8 ++++---- controllers/admin/AdminScenesController.php | 7 ++++--- controllers/admin/AdminStoresController.php | 3 +-- 8 files changed, 20 insertions(+), 25 deletions(-) diff --git a/classes/Image.php b/classes/Image.php index 510e2ba92..9c140deb0 100644 --- a/classes/Image.php +++ b/classes/Image.php @@ -233,13 +233,12 @@ class ImageCore extends ObjectModel $new_path = $image_new->getPathForCreation(); foreach ($images_types as $image_type) { - $theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : ''); - if (file_exists(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'-'.$image_type['name'].$theme.'.jpg')) + if (file_exists(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'-'.$image_type['name'].'.jpg')) { if (!Configuration::get('PS_LEGACY_IMAGES')) $image_new->createImgFolder(); - copy(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'-'.$image_type['name'].$theme.'.jpg', - $new_path.'-'.$image_type['name'].$theme.'.jpg'); + copy(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'-'.$image_type['name'].'.jpg', + $new_path.'-'.$image_type['name'].'.jpg'); } } if (file_exists(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'.jpg')) @@ -398,8 +397,7 @@ class ImageCore extends ObjectModel $image_types = ImageType::getImagesTypes(); foreach ($image_types as $image_type) { - $theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : ''); - $files_to_delete[] = $this->image_dir.$this->getExistingImgPath().'-'.$image_type['name'].$theme.'.'.$this->image_format; + $files_to_delete[] = $this->image_dir.$this->getExistingImgPath().'-'.$image_type['name'].'.'.$this->image_format; } // Delete watermark image $files_to_delete[] = $this->image_dir.$this->getExistingImgPath().'-watermark.'.$this->image_format; diff --git a/controllers/admin/AdminCategoriesController.php b/controllers/admin/AdminCategoriesController.php index df1c514bd..02626beb9 100644 --- a/controllers/admin/AdminCategoriesController.php +++ b/controllers/admin/AdminCategoriesController.php @@ -580,14 +580,14 @@ class AdminCategoriesControllerCore extends AdminController $images_types = ImageType::getImagesTypes('categories'); foreach ($images_types as $k => $image_type) { - $theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : ''); ImageManager::resize( _PS_CAT_IMG_DIR_.$id_category.'.jpg', - _PS_CAT_IMG_DIR_.$id_category.'-'.stripslashes($image_type['name']).$theme.'.jpg', + _PS_CAT_IMG_DIR_.$id_category.'-'.stripslashes($image_type['name']).'.jpg', (int)$image_type['width'], (int)$image_type['height'] ); } } + return $ret; } diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 50d8cec45..c8c79b2a1 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -772,8 +772,7 @@ class AdminImportControllerCore extends AdminController $images_types = ImageType::getImagesTypes($entity); foreach ($images_types as $k => $image_type) { - $theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : ''); - ImageManager::resize($tmpfile, $path.'-'.stripslashes($image_type['name']).$theme.'.jpg', $image_type['width'], $image_type['height']); + ImageManager::resize($tmpfile, $path.'-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']); } if (in_array($image_type['id_image_type'], $watermark_types)) Hook::exec('actionWatermark', array('id_image' => $id_image, 'id_product' => $id_entity)); diff --git a/controllers/admin/AdminLanguagesController.php b/controllers/admin/AdminLanguagesController.php index ec781e85e..27411e32d 100644 --- a/controllers/admin/AdminLanguagesController.php +++ b/controllers/admin/AdminLanguagesController.php @@ -432,12 +432,11 @@ class AdminLanguagesControllerCore extends AdminController $images_types = ImageType::getImagesTypes('products'); foreach ($images_types as $k => $image_type) { - $theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : ''); - if (!ImageManager::resize($tmp_name, _PS_IMG_DIR_.'p/'.$language.'-default-'.stripslashes($image_type['name']).$theme.'.jpg', $image_type['width'], $image_type['height'])) + if (!ImageManager::resize($tmp_name, _PS_IMG_DIR_.'p/'.$language.'-default-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height'])) $this->errors[] = Tools::displayError('An error occurred while resizing no-picture image to your product directory.'); - if (!ImageManager::resize($tmp_name, _PS_IMG_DIR_.'c/'.$language.'-default-'.stripslashes($image_type['name']).$theme.'.jpg', $image_type['width'], $image_type['height'])) + if (!ImageManager::resize($tmp_name, _PS_IMG_DIR_.'c/'.$language.'-default-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height'])) $this->errors[] = Tools::displayError('An error occurred while resizing no-picture image to your category directory.'); - if (!ImageManager::resize($tmp_name, _PS_IMG_DIR_.'m/'.$language.'-default-'.stripslashes($image_type['name']).$theme.'.jpg', $image_type['width'], $image_type['height'])) + if (!ImageManager::resize($tmp_name, _PS_IMG_DIR_.'m/'.$language.'-default-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height'])) $this->errors[] = Tools::displayError('An error occurred while resizing no-picture image to your manufacturer directory.'); } } diff --git a/controllers/admin/AdminManufacturersController.php b/controllers/admin/AdminManufacturersController.php index 4a58096db..d80234d0a 100644 --- a/controllers/admin/AdminManufacturersController.php +++ b/controllers/admin/AdminManufacturersController.php @@ -685,10 +685,9 @@ class AdminManufacturersControllerCore extends AdminController $images_types = ImageType::getImagesTypes('manufacturers'); foreach ($images_types as $k => $image_type) { - $theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : ''); ImageManager::resize( _PS_MANU_IMG_DIR_.$id_manufacturer.'.jpg', - _PS_MANU_IMG_DIR_.$id_manufacturer.'-'.stripslashes($image_type['name']).$theme.'.jpg', + _PS_MANU_IMG_DIR_.$id_manufacturer.'-'.stripslashes($image_type['name']).'.jpg', (int)$image_type['width'], (int)$image_type['height'] ); diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index a5c0498d1..264d3fba1 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -647,7 +647,7 @@ class AdminProductsControllerCore extends AdminController if (!empty($is_virtual)) Product::updateIsVirtual($product->id); - $this->redirect_after = self::$currentIndex.'&id_product='.$product->id.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&add'.$this->table.'&conf=4&action=Combinations&token='.($token ? $token : $this->token); + //$this->redirect_after = self::$currentIndex.'&id_product='.$product->id.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&add'.$this->table.'&conf=4&action=Combinations&token='.($token ? $token : $this->token); } } } @@ -997,6 +997,7 @@ class AdminProductsControllerCore extends AdminController // And if still not set, use default if (!$this->tab_display) $this->tab_display = $this->default_tab; + } /** @@ -1359,8 +1360,7 @@ class AdminProductsControllerCore extends AdminController $imagesTypes = ImageType::getImagesTypes('products'); foreach ($imagesTypes as $k => $image_type) { - $theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : ''); - if (!ImageManager::resize($tmpName, $new_path.'-'.stripslashes($image_type['name']).$theme.'.'.$image->image_format, $image_type['width'], $image_type['height'], $image->image_format)) + if (!ImageManager::resize($tmpName, $new_path.'-'.stripslashes($image_type['name']).'.'.$image->image_format, $image_type['width'], $image_type['height'], $image->image_format)) $this->errors[] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($image_type['name']); } } @@ -1481,7 +1481,7 @@ class AdminProductsControllerCore extends AdminController $this->processWarehouses($token); $this->processFeatures($token); $this->processProductAttribute($token); - +//d($this->redirect_after); if (!$this->updatePackItems($object)) $this->errors[] = Tools::displayError('An error occurred while adding products to the pack.'); elseif (!$object->updateCategories(Tools::getValue('categoryBox'), true)) diff --git a/controllers/admin/AdminScenesController.php b/controllers/admin/AdminScenesController.php index 77b2b899c..e8e3bd690 100644 --- a/controllers/admin/AdminScenesController.php +++ b/controllers/admin/AdminScenesController.php @@ -72,13 +72,13 @@ class AdminScenesControllerCore extends AdminController if ($obj->id && (isset($_FILES['image']) || isset($_FILES['thumb']))) { $images_types = ImageType::getImagesTypes('scenes'); + foreach ($images_types as $k => $image_type) { - $theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : ''); if ($image_type['name'] == 'large_scene' && isset($_FILES['image'])) ImageManager::resize( $_FILES['image']['tmp_name'], - _PS_SCENE_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).$theme.'.jpg', + _PS_SCENE_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).'.jpg', (int)$image_type['width'], (int)$image_type['height'] ); @@ -90,13 +90,14 @@ class AdminScenesControllerCore extends AdminController $tmp_name = $_FILES['image']['tmp_name']; ImageManager::resize( $tmp_name, - _PS_SCENE_THUMB_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).$theme.'.jpg', + _PS_SCENE_THUMB_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).'.jpg', (int)$image_type['width'], (int)$image_type['height'] ); } } } + return true; } diff --git a/controllers/admin/AdminStoresController.php b/controllers/admin/AdminStoresController.php index e53f141c9..7aa441687 100644 --- a/controllers/admin/AdminStoresController.php +++ b/controllers/admin/AdminStoresController.php @@ -375,9 +375,8 @@ class AdminStoresControllerCore extends AdminController $images_types = ImageType::getImagesTypes('stores'); foreach ($images_types as $k => $image_type) { - $theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : ''); ImageManager::resize(_PS_STORE_IMG_DIR_.$id_store.'.jpg', - _PS_STORE_IMG_DIR_.$id_store.'-'.stripslashes($image_type['name']).$theme.'.jpg', + _PS_STORE_IMG_DIR_.$id_store.'-'.stripslashes($image_type['name']).'.jpg', (int)$image_type['width'], (int)$image_type['height'] ); }