* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 7310 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class AdminImageResize extends AdminTab { public function postProcess() { $context = Context::getContext(); if (isset($_POST['resize'])) { $imagesTypes = ImageType::getImagesTypes('products'); $sourceFile['tmp_name'] = _PS_IMG_DIR_.'/p/'.Tools::getValue('id_product').'-'.Tools::getValue('id_image').'.jpg'; foreach ($imagesTypes AS $k => $imageType) if (!imageCut ($sourceFile, _PS_IMG_DIR_.'p/'.Tools::getValue('id_product').'-'.Tools::getValue('id_image').'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height'], 'jpg', $_POST[$imageType['id_image_type'].'_x1'], $_POST[$imageType['id_image_type'].'_y1'])) $this->_errors = Tools::displayError('An error occurred while copying image.').' '.stripslashes($imageType['name']); // Save and stay on same form if (Tools::getValue('saveandstay') == 'on') Tools::redirectAdmin(self::$currentIndex.'&id_product='.Tools::getValue('id_product').'&id_category='.(int)(Tools::getValue('id_category')).'&addproduct&conf=4&tabs=1&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id)); // Default behavior (save and back) Tools::redirectAdmin(self::$currentIndex.'&id_category='.(int)(Tools::getValue('id_category')).'&conf='.(int)(Tools::getValue('conf')).'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id)); } else parent::postProcess(); } public function displayForm($isMainTab = true) { $context = Context::getContext(); parent::displayForm(); $imagesTypes = ImageType::getImagesTypes(); $imageObj = new Image(Tools::getValue('id_image')); echo '
'; } }