xaxa Posted January 30, 2017 Share Posted January 30, 2017 (edited) Bonjour, j'aimerais remplacer l'image de ma catégorie sans remplacer la miniature de la catégorie. (Version 1.6.1.9) J'ai essayé ce genre de code dans override/controllers/admin/AdminCategoriesController.php : protected function postImage($id) { $ret = AdminController::postImage($id); if (($id_category = (int)Tools::getValue('id_category')) && isset($_FILES) && count($_FILES)) { $name = 'image'; if ($_FILES[$name]['name'] != null && file_exists(_PS_CAT_IMG_DIR_.$id_category.'.'.$this->imageType)) { $images_types = ImageType::getImagesTypes('categories'); foreach ($images_types as $k => $image_type) { if($image_type['name']!='category_miniature') { if (!ImageManager::resize( _PS_CAT_IMG_DIR_.$id_category.'.'.$this->imageType, _PS_CAT_IMG_DIR_.$id_category.'-'.stripslashes($image_type['name']).'.'.$this->imageType, (int)$image_type['width'], (int)$image_type['height'] )) { $this->errors = Tools::displayError('An error occurred while uploading category image.'); } } } } $name = 'thumb'; if ($_FILES[$name]['name'] != null) { if (!isset($images_types)) { $images_types = ImageType::getImagesTypes('categories'); } category_miniature correspond au format utilisé par mes miniatures. Quelqu'un aurait-il réussi ou a une idée du code? Merci à vous. Edited January 30, 2017 by xaxa (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now