protected function postImage($id) { $ret = parent::postImage($id); $generate_hight_dpi_images = (bool) Configuration::get('PS_HIGHT_DPI'); if (($id_store = (int) Tools::getValue('id_store')) && isset($_FILES) && count($_FILES) && file_exists(_PS_STORE_IMG_DIR_ . $id_store . '.jpg')) { $images_types = ImageType::getImagesTypes('stores'); foreach ($images_types as $k => $image_type) { ImageManager::resize(_PS_STORE_IMG_DIR_ . $id_store . '.jpg', _PS_STORE_IMG_DIR_ . $id_store . '-' . stripslashes($image_type['name']) . '.jpg', (int) $image_type['width'], (int) $image_type['height']); if ($generate_hight_dpi_images) { ImageManager::resize(_PS_STORE_IMG_DIR_ . $id_store . '.jpg', _PS_STORE_IMG_DIR_ . $id_store . '-' . stripslashes($image_type['name']) . '2x.jpg', (int) $image_type['width'] * 2, (int) $image_type['height'] * 2); } } } return $ret; }
protected function postImage($id) { $ret = parent::postImage($id); if (($id_category = (int) Tools::getValue('id_category')) && isset($_FILES) && count($_FILES) && $_FILES['image']['name'] != null && file_exists(_PS_CAT_IMG_DIR_ . $id_category . '.jpg')) { $images_types = ImageType::getImagesTypes('categories'); foreach ($images_types as $k => $image_type) { ImageManager::resize(_PS_CAT_IMG_DIR_ . $id_category . '.jpg', _PS_CAT_IMG_DIR_ . $id_category . '-' . stripslashes($image_type['name']) . '.jpg', (int) $image_type['width'], (int) $image_type['height']); } } return $ret; }
protected function postImage($id) { $ret = parent::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 (!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 = $this->trans('An error occurred while uploading category image.', array(), 'Admin.Catalog.Notification'); } } } $name = 'thumb'; if ($_FILES[$name]['name'] != null) { if (!isset($images_types)) { $images_types = ImageType::getImagesTypes('categories'); } $formatted_small = ImageType::getFormattedName('small'); foreach ($images_types as $k => $image_type) { if ($formatted_small == $image_type['name']) { if ($error = ImageManager::validateUpload($_FILES[$name], Tools::getMaxUploadSize())) { $this->errors[] = $error; } elseif (!($tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS')) || !move_uploaded_file($_FILES[$name]['tmp_name'], $tmpName)) { $ret = false; } else { if (!ImageManager::resize($tmpName, _PS_CAT_IMG_DIR_ . $id_category . '-' . stripslashes($image_type['name']) . '.' . $this->imageType, (int) $image_type['width'], (int) $image_type['height'])) { $this->errors = $this->trans('An error occurred while uploading thumbnail image.', array(), 'Admin.Catalog.Notification'); } elseif (($infos = getimagesize($tmpName)) && is_array($infos)) { ImageManager::resize($tmpName, _PS_CAT_IMG_DIR_ . $id_category . '_' . $name . '.' . $this->imageType, (int) $infos[0], (int) $infos[1]); } if (count($this->errors)) { $ret = false; } unlink($tmpName); $ret = true; } } } } } return $ret; }