From dc027cb3cf557465b80a58b6cad321ace41b9cd8 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 21 Feb 2013 11:52:42 +0100 Subject: [PATCH] // Unit changed for product pictures, I set it up to a usable minimum #PSCFV-6597 --- classes/ImageManager.php | 6 +---- controllers/admin/AdminProductsController.php | 23 +++++++++---------- install-dev/upgrade/sql/1.5.4.0.sql | 4 +++- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/classes/ImageManager.php b/classes/ImageManager.php index 57a3d4a52..c7500c8fd 100644 --- a/classes/ImageManager.php +++ b/classes/ImageManager.php @@ -270,11 +270,7 @@ class ImageManagerCore public static function validateUpload($file, $max_file_size = 0) { if ((int)$max_file_size > 0 && $file['size'] > (int)$max_file_size) - return sprintf( - Tools::displayError('Image is too large (%1$d kB). Maximum allowed: %2$d kB'), - $file['size'] / 1000, - $max_file_size / 1000 - ); + return sprintf(Tools::displayError('Image is too large (%1$d kB). Maximum allowed: %2$d kB'), $file['size'] / 1024, $max_file_size / 1024); if (!ImageManager::isRealImage($file['tmp_name'], $file['type']) || !ImageManager::isCorrectImageFileExt($file['name'])) return Tools::displayError('Image format not recognized, allowed formats are: .gif, .jpg, .png'); if ($file['error']) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 2042076ca..bd7a7c6bc 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -3474,18 +3474,17 @@ class AdminProductsControllerCore extends AdminController $current_shop_id = 0; $data->assign(array( - 'countImages' => $count_images, - 'id_product' => (int)Tools::getValue('id_product'), - 'id_category_default' => (int)$this->_category->id, - 'images' => $images, - 'token' => $this->token, - 'table' => $this->table, - 'max_image_size' => $this->max_image_size / 1024 / 1024, - 'up_filename' => (string)Tools::getValue('virtual_product_filename_attribute'), - 'currency' => $this->context->currency, - 'current_shop_id' => $current_shop_id - ) - ); + 'countImages' => $count_images, + 'id_product' => (int)Tools::getValue('id_product'), + 'id_category_default' => (int)$this->_category->id, + 'images' => $images, + 'token' => $this->token, + 'table' => $this->table, + 'max_image_size' => $this->max_image_size / 1024 / 1024, + 'up_filename' => (string)Tools::getValue('virtual_product_filename_attribute'), + 'currency' => $this->context->currency, + 'current_shop_id' => $current_shop_id + )); } else $this->displayWarning($this->l('You must save the product in this shop before adding images.')); diff --git a/install-dev/upgrade/sql/1.5.4.0.sql b/install-dev/upgrade/sql/1.5.4.0.sql index 831476016..e846530e7 100644 --- a/install-dev/upgrade/sql/1.5.4.0.sql +++ b/install-dev/upgrade/sql/1.5.4.0.sql @@ -34,4 +34,6 @@ CREATE TABLE `PREFIX_tab_module_preference` ( /* PHP:add_new_tab(AdminMarketing, es:Marketing|it:Marketing|en:Marketing|de:Marketing|fr:Marketing, 1); */; ALTER TABLE `PREFIX_stock_available` DROP INDEX `product_sqlstock`; -ALTER TABLE `PREFIX_stock_available` ADD UNIQUE `product_sqlstock` (`id_product`, `id_product_attribute`, `id_shop`, `id_shop_group`); \ No newline at end of file +ALTER TABLE `PREFIX_stock_available` ADD UNIQUE `product_sqlstock` (`id_product`, `id_product_attribute`, `id_shop`, `id_shop_group`); + +UPDATE PREFIX_configuration SET `value` = '8388608' WHERE `name` = 'PS_PRODUCT_PICTURE_MAX_SIZE' AND `value` <= '524288';