[*] Classes : images.inc.php functions are now all deprecated, use the new class ImageManager instead
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12596 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -159,7 +159,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$product['qty_in_stock'] = StockAvailable::getQuantityAvailableByProduct($product['id_product'], isset($product['id_product_attribute']) ? $product['id_product_attribute'] : null, (int)$order->id_shop);
|
||||
|
||||
$image_product = new Image($image['id_image']);
|
||||
$product['image'] = (isset($image['id_image']) ? cacheImage(_PS_IMG_DIR_.'p/'.$image_product->getExistingImgPath().'.jpg', 'product_mini_'.(int)$product['id_product'].(isset($product['id_product_attribute']) ? '_'.(int)$product['id_product_attribute'] : '').'.jpg', 45, 'jpg') : '--');
|
||||
$product['image'] = (isset($image['id_image']) ? ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$image_product->getExistingImgPath().'.jpg', 'product_mini_'.(int)$product['id_product'].(isset($product['id_product_attribute']) ? '_'.(int)$product['id_product_attribute'] : '').'.jpg', 45, 'jpg') : '--');
|
||||
}
|
||||
|
||||
$this->tpl_view_vars = array(
|
||||
|
||||
@@ -401,7 +401,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$image = cacheImage(_PS_CAT_IMG_DIR_.'/'.$obj->id.'.jpg', $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350, $this->imageType, true);
|
||||
$image = ImageManager::thumbnail(_PS_CAT_IMG_DIR_.'/'.$obj->id.'.jpg', $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350, $this->imageType, true);
|
||||
|
||||
$this->fields_value = array(
|
||||
'image' => $image ? $image : false,
|
||||
@@ -546,7 +546,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
foreach ($images_types as $k => $image_type)
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
|
||||
imageResize(
|
||||
ImageManager::resize(
|
||||
_PS_CAT_IMG_DIR_.$id_category.'.jpg',
|
||||
_PS_CAT_IMG_DIR_.$id_category.'-'.stripslashes($image_type['name']).$theme.'.jpg',
|
||||
(int)$image_type['width'], (int)$image_type['height']
|
||||
|
||||
@@ -369,7 +369,7 @@ class AdminImagesControllerCore extends AdminController
|
||||
if (!file_exists($newDir))
|
||||
continue;
|
||||
if (!file_exists($newDir.substr($image, 0, -4).'-'.stripslashes($imageType['name']).'.jpg'))
|
||||
if (!imageResize($dir.$image, $newDir.substr($image, 0, -4).'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
|
||||
if (!ImageManager::resize($dir.$image, $newDir.substr($image, 0, -4).'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
|
||||
$errors = true;
|
||||
if (time() - $this->start_time > $this->max_execution_time - 4) // stop 4 seconds before the tiemout, just enough time to process the end of the page on a slow server
|
||||
return 'timeout';
|
||||
@@ -385,7 +385,7 @@ class AdminImagesControllerCore extends AdminController
|
||||
foreach ($type AS $k => $imageType)
|
||||
{
|
||||
if (!file_exists($dir.$imageObj->getExistingImgPath().'-'.stripslashes($imageType['name']).'.jpg'))
|
||||
if (!imageResize($dir.$imageObj->getExistingImgPath().'.jpg', $dir.$imageObj->getExistingImgPath().'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
|
||||
if (!ImageManager::resize($dir.$imageObj->getExistingImgPath().'.jpg', $dir.$imageObj->getExistingImgPath().'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
|
||||
$errors = true;
|
||||
if (time() - $this->start_time > $this->max_execution_time - 4) // stop 4 seconds before the tiemout, just enough time to process the end of the page on a slow server
|
||||
return 'timeout';
|
||||
@@ -408,7 +408,7 @@ class AdminImagesControllerCore extends AdminController
|
||||
if (!file_exists($file))
|
||||
$file = _PS_PROD_IMG_DIR_.Language::getIsoById((int)(Configuration::get('PS_LANG_DEFAULT'))).'.jpg';
|
||||
if (!file_exists($dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).'.jpg'))
|
||||
if (!imageResize($file, $dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
|
||||
if (!ImageManager::resize($file, $dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).'.jpg', (int)$imageType['width'], (int)$imageType['height']))
|
||||
$errors = true;
|
||||
}
|
||||
}
|
||||
@@ -424,14 +424,14 @@ class AdminImagesControllerCore extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'hook` h ON hm.`id_hook` = h.`id_hook`
|
||||
WHERE h.`name` = \'watermark\' AND m.`active` = 1');
|
||||
|
||||
if ($result AND sizeof($result))
|
||||
if ($result && count($result))
|
||||
{
|
||||
$productsImages = Image::getAllImages();
|
||||
foreach ($productsImages AS $k => $image)
|
||||
foreach ($productsImages as $image)
|
||||
{
|
||||
$imageObj = new Image($image['id_image']);
|
||||
if (file_exists($dir.$imageObj->getExistingImgPath().'.jpg'))
|
||||
foreach ($result AS $k => $module)
|
||||
foreach ($result as $module)
|
||||
{
|
||||
if ($moduleInstance = Module::getInstanceByName($module['name']) AND is_callable(array($moduleInstance, 'hookwatermark')))
|
||||
call_user_func(array($moduleInstance, 'hookwatermark'), array('id_image' => $imageObj->id, 'id_product' => $imageObj->id_product));
|
||||
|
||||
@@ -778,12 +778,12 @@ class AdminImportControllerCore extends AdminController
|
||||
// Just hide the warning, the traitment will be the same.
|
||||
if (@copy($url, $tmpfile))
|
||||
{
|
||||
imageResize($tmpfile, $path.'.jpg');
|
||||
ImageManager::resize($tmpfile, $path.'.jpg');
|
||||
$images_types = ImageType::getImagesTypes($entity);
|
||||
foreach ($images_types as $k => $image_type)
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
|
||||
imageResize($tmpfile, $path.'-'.stripslashes($image_type['name']).$theme.'.jpg', $image_type['width'], $image_type['height']);
|
||||
ImageManager::resize($tmpfile, $path.'-'.stripslashes($image_type['name']).$theme.'.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));
|
||||
|
||||
@@ -415,17 +415,17 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
public function copyNoPictureImage($language)
|
||||
{
|
||||
if (isset($_FILES['no-picture']) && $_FILES['no-picture']['error'] === 0)
|
||||
if ($error = checkImage($_FILES['no-picture'], Tools::getMaxUploadSize()))
|
||||
if ($error = ImageManager::validateUpload($_FILES['no-picture'], Tools::getMaxUploadSize()))
|
||||
$this->errors[] = $error;
|
||||
else
|
||||
{
|
||||
if (!$tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS') || !move_uploaded_file($_FILES['no-picture']['tmp_name'], $tmp_name))
|
||||
return false;
|
||||
if (!imageResize($tmp_name, _PS_IMG_DIR_.'p/'.$language.'.jpg'))
|
||||
if (!ImageManager::resize($tmp_name, _PS_IMG_DIR_.'p/'.$language.'.jpg'))
|
||||
$this->errors[] = Tools::displayError('An error occurred while copying no-picture image to your product folder.');
|
||||
if (!imageResize($tmp_name, _PS_IMG_DIR_.'c/'.$language.'.jpg'))
|
||||
if (!ImageManager::resize($tmp_name, _PS_IMG_DIR_.'c/'.$language.'.jpg'))
|
||||
$this->errors[] = Tools::displayError('An error occurred while copying no-picture image to your category folder.');
|
||||
if (!imageResize($tmp_name, _PS_IMG_DIR_.'m/'.$language.'.jpg'))
|
||||
if (!ImageManager::resize($tmp_name, _PS_IMG_DIR_.'m/'.$language.'.jpg'))
|
||||
$this->errors[] = Tools::displayError('An error occurred while copying no-picture image to your manufacturer folder');
|
||||
else
|
||||
{
|
||||
@@ -433,11 +433,11 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
foreach ($images_types as $k => $image_type)
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
|
||||
if (!imageResize($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']).$theme.'.jpg', $image_type['width'], $image_type['height']))
|
||||
$this->errors[] = Tools::displayError('An error occurred while resizing no-picture image to your product directory.');
|
||||
if (!imageResize($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']).$theme.'.jpg', $image_type['width'], $image_type['height']))
|
||||
$this->errors[] = Tools::displayError('An error occurred while resizing no-picture image to your category directory.');
|
||||
if (!imageResize($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']).$theme.'.jpg', $image_type['width'], $image_type['height']))
|
||||
$this->errors[] = Tools::displayError('An error occurred while resizing no-picture image to your manufacturer directory.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
'class' => 'button'
|
||||
);
|
||||
|
||||
$image = cacheImage(_PS_MANU_IMG_DIR_.'/'.$manufacturer->id.'.jpg', $this->table.'_'.(int)$manufacturer->id.'.'.$this->imageType, 350, $this->imageType, true);
|
||||
$image = ImageManager::thumbnail(_PS_MANU_IMG_DIR_.'/'.$manufacturer->id.'.jpg', $this->table.'_'.(int)$manufacturer->id.'.'.$this->imageType, 350, $this->imageType, true);
|
||||
|
||||
$this->fields_value = array(
|
||||
'image' => $image ? $image : false,
|
||||
@@ -685,7 +685,7 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
foreach ($images_types as $k => $image_type)
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
|
||||
imageResize(
|
||||
ImageManager::resize(
|
||||
_PS_MANU_IMG_DIR_.$id_manufacturer.'.jpg',
|
||||
_PS_MANU_IMG_DIR_.$id_manufacturer.'-'.stripslashes($image_type['name']).$theme.'.jpg',
|
||||
(int)$image_type['width'],
|
||||
|
||||
@@ -1732,7 +1732,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
{
|
||||
$name = 'product_mini_'.(int)$product['product_id'].(isset($product['product_attribute_id']) ? '_'.(int)$product['product_attribute_id'] : '').'.jpg';
|
||||
// generate image cache, only for back office
|
||||
$product['image_tag'] = cacheImage(_PS_IMG_DIR_.'p/'.$product['image']->getExistingImgPath().'.jpg', $name, 45, 'jpg');
|
||||
$product['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$product['image']->getExistingImgPath().'.jpg', $name, 45, 'jpg');
|
||||
if (file_exists(_PS_TMP_IMG_DIR_.$name))
|
||||
$product['image_size'] = getimagesize(_PS_TMP_IMG_DIR_.$name);
|
||||
else
|
||||
|
||||
@@ -1339,7 +1339,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if (!isset($_FILES['image_product']['tmp_name']))
|
||||
return false;
|
||||
if ($error = checkImage($_FILES['image_product']))
|
||||
if ($error = ImageManager::validateUpload($_FILES['image_product']))
|
||||
$this->errors[] = $error;
|
||||
else
|
||||
{
|
||||
@@ -1349,7 +1349,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('An error occurred during new folder creation');
|
||||
if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') || !move_uploaded_file($_FILES['image_product']['tmp_name'], $tmpName))
|
||||
$this->errors[] = Tools::displayError('An error occurred during the image upload');
|
||||
else if (!imageResize($tmpName, $new_path.'.'.$image->image_format))
|
||||
else if (!ImageManager::resize($tmpName, $new_path.'.'.$image->image_format))
|
||||
$this->errors[] = Tools::displayError('An error occurred while copying image.');
|
||||
else if ($method == 'auto')
|
||||
{
|
||||
@@ -1357,7 +1357,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
foreach ($imagesTypes as $k => $image_type)
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
|
||||
if (!imageResize($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']).$theme.'.'.$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']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class AdminScenesControllerCore extends AdminController
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
|
||||
if ($image_type['name'] == 'large_scene' && isset($_FILES['image']))
|
||||
imageResize(
|
||||
ImageManager::resize(
|
||||
$_FILES['image']['tmp_name'],
|
||||
_PS_SCENE_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).$theme.'.jpg',
|
||||
(int)$image_type['width'],
|
||||
@@ -88,7 +88,7 @@ class AdminScenesControllerCore extends AdminController
|
||||
$tmp_name = $_FILES['thumb']['tmp_name'];
|
||||
else
|
||||
$tmp_name = $_FILES['image']['tmp_name'];
|
||||
imageResize(
|
||||
ImageManager::resize(
|
||||
$tmp_name,
|
||||
_PS_SCENE_THUMB_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).$theme.'.jpg',
|
||||
(int)$image_type['width'],
|
||||
|
||||
@@ -269,7 +269,7 @@ class AdminStoresControllerCore extends AdminController
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$image = cacheImage(_PS_STORE_IMG_DIR_.'/'.$obj->id.'.jpg', $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350, $this->imageType, true);
|
||||
$image = ImageManager::thumbnail(_PS_STORE_IMG_DIR_.'/'.$obj->id.'.jpg', $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350, $this->imageType, true);
|
||||
|
||||
$days = array();
|
||||
$days[1] = $this->l('Monday');
|
||||
@@ -376,7 +376,7 @@ class AdminStoresControllerCore extends AdminController
|
||||
foreach ($images_types as $k => $image_type)
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
|
||||
imageResize(_PS_STORE_IMG_DIR_.$id_store.'.jpg',
|
||||
ImageManager::resize(_PS_STORE_IMG_DIR_.$id_store.'.jpg',
|
||||
_PS_STORE_IMG_DIR_.$id_store.'-'.stripslashes($image_type['name']).$theme.'.jpg',
|
||||
(int)$image_type['width'], (int)$image_type['height']
|
||||
);
|
||||
|
||||
@@ -243,7 +243,7 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
// set logo image
|
||||
$image = cacheImage(_PS_SUPP_IMG_DIR_.'/'.$this->object->id.'.jpg', $this->table.'_'.(int)$this->object->id.'.'.$this->imageType, 350, $this->imageType, true);
|
||||
$image = ImageManager::thumbnail(_PS_SUPP_IMG_DIR_.'/'.$this->object->id.'.jpg', $this->table.'_'.(int)$this->object->id.'.'.$this->imageType, 350, $this->imageType, true);
|
||||
$this->fields_value['image'] = $image ? $image : false;
|
||||
$this->fields_value['size'] = $image ? filesize(_PS_SUPP_IMG_DIR_.'/'.$this->object->id.'.jpg') / 1000 : false;
|
||||
|
||||
@@ -320,7 +320,7 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
{
|
||||
$file = _PS_SUPP_IMG_DIR_.$id_supplier.'.jpg';
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
|
||||
imageResize($file, _PS_SUPP_IMG_DIR_.$id_supplier.'-'.stripslashes($image_type['name']).$theme.'.jpg', (int)$image_type['width'], (int)$image_type['height']);
|
||||
ImageManager::resize($file, _PS_SUPP_IMG_DIR_.$id_supplier.'-'.stripslashes($image_type['name']).$theme.'.jpg', (int)$image_type['width'], (int)$image_type['height']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,13 +449,13 @@ class AdminThemesControllerCore extends AdminController
|
||||
$id_shop = Context::getContext()->shop->getID();
|
||||
if (isset($_FILES['PS_LOGO']['tmp_name']) AND $_FILES['PS_LOGO']['tmp_name'])
|
||||
{
|
||||
if ($error = checkImage($_FILES['PS_LOGO'], 300000))
|
||||
if ($error = ImageManager::validateUpload($_FILES['PS_LOGO'], 300000))
|
||||
$this->errors[] = $error;
|
||||
if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') OR !move_uploaded_file($_FILES['PS_LOGO']['tmp_name'], $tmpName))
|
||||
return false;
|
||||
if ($id_shop == Configuration::get('PS_SHOP_DEFAULT') && !@imageResize($tmpName, _PS_IMG_DIR_.'logo.jpg'))
|
||||
if ($id_shop == Configuration::get('PS_SHOP_DEFAULT') && !@ImageManager::resize($tmpName, _PS_IMG_DIR_.'logo.jpg'))
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
if (!@imageResize($tmpName, _PS_IMG_DIR_.'logo-'.(int)$id_shop.'.jpg'))
|
||||
if (!@ImageManager::resize($tmpName, _PS_IMG_DIR_.'logo-'.(int)$id_shop.'.jpg'))
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
|
||||
unlink($tmpName);
|
||||
@@ -470,13 +470,13 @@ class AdminThemesControllerCore extends AdminController
|
||||
$id_shop = Context::getContext()->shop->getID();
|
||||
if (isset($_FILES['PS_LOGO_MAIL']['tmp_name']) AND $_FILES['PS_LOGO_MAIL']['tmp_name'])
|
||||
{
|
||||
if ($error = checkImage($_FILES['PS_LOGO_MAIL'], 300000))
|
||||
if ($error = ImageManager::validateUpload($_FILES['PS_LOGO_MAIL'], 300000))
|
||||
$this->errors[] = $error;
|
||||
if (!$tmpName == tempnam(_PS_TMP_IMG_DIR_, 'PS_MAIL') OR !move_uploaded_file($_FILES['PS_LOGO_MAIL']['tmp_name'], $tmpName))
|
||||
return false;
|
||||
if ($id_shop == Configuration::get('PS_SHOP_DEFAULT') && !@imageResize($tmpName, _PS_IMG_DIR_.'logo_mail.jpg'))
|
||||
if ($id_shop == Configuration::get('PS_SHOP_DEFAULT') && !@ImageManager::resize($tmpName, _PS_IMG_DIR_.'logo_mail.jpg'))
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
if (!@imageResize($tmpName, _PS_IMG_DIR_.'logo_mail-'.(int)$id_shop.'.jpg'))
|
||||
if (!@ImageManager::resize($tmpName, _PS_IMG_DIR_.'logo_mail-'.(int)$id_shop.'.jpg'))
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
unlink($tmpName);
|
||||
}
|
||||
@@ -490,13 +490,13 @@ class AdminThemesControllerCore extends AdminController
|
||||
$id_shop = Context::getContext()->shop->getID();
|
||||
if (isset($_FILES['PS_LOGO_INVOICE']['tmp_name']) AND $_FILES['PS_LOGO_INVOICE']['tmp_name'])
|
||||
{
|
||||
if ($error = checkImage($_FILES['PS_LOGO_INVOICE'], 300000))
|
||||
if ($error = ImageManager::validateUpload($_FILES['PS_LOGO_INVOICE'], 300000))
|
||||
$this->errors[] = $error;
|
||||
if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS_INVOICE') OR !move_uploaded_file($_FILES['PS_LOGO_INVOICE']['tmp_name'], $tmpName))
|
||||
return false;
|
||||
if ($id_shop == Configuration::get('PS_SHOP_DEFAULT') && !@imageResize($tmpName, _PS_IMG_DIR_.'logo_invoice.jpg'))
|
||||
if ($id_shop == Configuration::get('PS_SHOP_DEFAULT') && !@ImageManager::resize($tmpName, _PS_IMG_DIR_.'logo_invoice.jpg'))
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
if (!@imageResize($tmpName, _PS_IMG_DIR_.'logo_invoice-'.(int)$id_shop.'.jpg'))
|
||||
if (!@ImageManager::resize($tmpName, _PS_IMG_DIR_.'logo_invoice-'.(int)$id_shop.'.jpg'))
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
|
||||
unlink($tmpName);
|
||||
@@ -511,13 +511,13 @@ class AdminThemesControllerCore extends AdminController
|
||||
$id_shop = Context::getContext()->shop->getID();
|
||||
if (isset($_FILES['PS_STORES_ICON']['tmp_name']) AND $_FILES['PS_STORES_ICON']['tmp_name'])
|
||||
{
|
||||
if ($error = checkImage($_FILES['PS_STORES_ICON'], 300000))
|
||||
if ($error = ImageManager::validateUpload($_FILES['PS_STORES_ICON'], 300000))
|
||||
$this->errors[] = $error;
|
||||
if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS_STORES_ICON') OR !move_uploaded_file($_FILES['PS_STORES_ICON']['tmp_name'], $tmpName))
|
||||
return false;
|
||||
if ($id_shop = Configuration::get('PS_SHOP_DEFAULT') && !@imageResize($tmpName, _PS_IMG_DIR_.'logo_stores.gif'))
|
||||
if ($id_shop = Configuration::get('PS_SHOP_DEFAULT') && !@ImageManager::resize($tmpName, _PS_IMG_DIR_.'logo_stores.gif'))
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
if (!@imageResize($tmpName, _PS_IMG_DIR_.'logo_stores-'.(int)$id_shop.'.gif'))
|
||||
if (!@ImageManager::resize($tmpName, _PS_IMG_DIR_.'logo_stores-'.(int)$id_shop.'.gif'))
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
unlink($tmpName);
|
||||
}
|
||||
@@ -532,7 +532,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
if (isset($_FILES[$name]['tmp_name']) && !empty($_FILES[$name]['tmp_name']))
|
||||
{
|
||||
/* Check ico validity */
|
||||
if ($error = checkIco($_FILES[$name]))
|
||||
if ($error = ImageManager::validateIconUpload($_FILES[$name]))
|
||||
$this->errors[] = $error;
|
||||
|
||||
/* Copy new ico */
|
||||
|
||||
Reference in New Issue
Block a user