[*] Classes : images.inc.php functions are now all deprecated, use the new class ImageManager instead
This commit is contained in:
@@ -143,7 +143,7 @@ class BlockAdvertising extends Module
|
||||
$file = false;
|
||||
if (isset($_FILES['adv_img']) AND isset($_FILES['adv_img']['tmp_name']) AND !empty($_FILES['adv_img']['tmp_name']))
|
||||
{
|
||||
if ($error = checkImage($_FILES['adv_img'], Tools::convertBytes(ini_get('upload_max_filesize'))))
|
||||
if ($error = ImageManager::validateUpload($_FILES['adv_img'], Tools::convertBytes(ini_get('upload_max_filesize'))))
|
||||
$errors .= $error;
|
||||
elseif ($dot_pos = strrpos($_FILES['adv_img']['name'],'.'))
|
||||
{
|
||||
|
||||
@@ -82,11 +82,11 @@ class blockreinsurance extends Module
|
||||
$filename = explode('.', $_FILES['info'.$i.'_file']['name']);
|
||||
if (isset($_FILES['info'.$i.'_file']) AND isset($_FILES['info'.$i.'_file']['tmp_name']) AND !empty($_FILES['info'.$i.'_file']['tmp_name']))
|
||||
{
|
||||
if ($error = checkImage($_FILES['info'.$i.'_file']))
|
||||
if ($error = ImageManager::validateUpload($_FILES['info'.$i.'_file']))
|
||||
return false;
|
||||
elseif (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') OR !move_uploaded_file($_FILES['info'.$i.'_file']['tmp_name'], $tmpName))
|
||||
return false;
|
||||
elseif (!imageResize($tmpName, dirname(__FILE__).'/img/'.$filename[0].'.jpg'))
|
||||
elseif (!ImageManager::resize($tmpName, dirname(__FILE__).'/img/'.$filename[0].'.jpg'))
|
||||
return false;
|
||||
unlink($tmpName);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ class BlockStore extends Module
|
||||
{
|
||||
if (isset($_FILES['store_img']) && isset($_FILES['store_img']['tmp_name']) && !empty($_FILES['store_img']['tmp_name']))
|
||||
{
|
||||
if ($error = checkImage($_FILES['store_img'], 4000000))
|
||||
if ($error = ImageManager::validateUpload($_FILES['store_img'], 4000000))
|
||||
return $this->displayError($this->l('invalid image'));
|
||||
else
|
||||
{
|
||||
|
||||
@@ -158,11 +158,11 @@ class Editorial extends Module
|
||||
Configuration::set('PS_IMAGE_GENERATION_METHOD', 1);
|
||||
if(file_exists(dirname(__FILE__).'/homepage_logo.jpg'))
|
||||
unlink(dirname(__FILE__).'/homepage_logo.jpg');
|
||||
if ($error = checkImage($_FILES['body_homepage_logo']))
|
||||
if ($error = ImageManager::validateUpload($_FILES['body_homepage_logo']))
|
||||
$errors .= $error;
|
||||
elseif (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') OR !move_uploaded_file($_FILES['body_homepage_logo']['tmp_name'], $tmpName))
|
||||
return false;
|
||||
elseif (!imageResize($tmpName, dirname(__FILE__).'/homepage_logo.jpg'))
|
||||
elseif (!ImageManager::resize($tmpName, dirname(__FILE__).'/homepage_logo.jpg'))
|
||||
$errors .= $this->displayError($this->l('An error occurred during the image upload.'));
|
||||
if (isset($tmpName))
|
||||
unlink($tmpName);
|
||||
|
||||
@@ -564,11 +564,11 @@ class HomeSlider extends Module
|
||||
{
|
||||
$temp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS');
|
||||
$salt = sha1(microtime());
|
||||
if ($error = checkImage($_FILES['image_'.$language['id_lang']]))
|
||||
if ($error = ImageManager::validateUpload($_FILES['image_'.$language['id_lang']]))
|
||||
$errors .= $error;
|
||||
else if (!$temp_name || !move_uploaded_file($_FILES['image_'.$language['id_lang']]['tmp_name'], $temp_name))
|
||||
return false;
|
||||
else if (!imageResize($temp_name, dirname(__FILE__).'/images/'.Tools::encrypt($_FILES['image_'.$language['id_lang']]['name'].$salt).$type))
|
||||
else if (!ImageManager::resize($temp_name, dirname(__FILE__).'/images/'.Tools::encrypt($_FILES['image_'.$language['id_lang']]['name'].$salt).$type))
|
||||
$errors .= $this->displayError($this->l('An error occurred during the image upload.'));
|
||||
if (isset($temp_name))
|
||||
@unlink($temp_name);
|
||||
|
||||
@@ -869,7 +869,7 @@ class shopimporter extends ImportModule
|
||||
{
|
||||
|
||||
$imagesTypes = ImageType::getImagesTypes($type);
|
||||
imageResize($tmpfile, $path.(int)$matchId[$item[$identifier]].'.jpg');
|
||||
ImageManager::resize($tmpfile, $path.(int)$matchId[$item[$identifier]].'.jpg');
|
||||
if ($className == 'Product')
|
||||
{
|
||||
$image = new Image();
|
||||
@@ -884,13 +884,13 @@ class shopimporter extends ImportModule
|
||||
$legend[Configuration::get('PS_LANG_DEFAULT')] = Tools::link_rewrite($val);
|
||||
$image->legend = $legend;
|
||||
$image->add();
|
||||
imageResize($tmpfile, $path.(int)$matchId[$item[$identifier]].'-'.(int)$image->id.'.jpg');
|
||||
ImageManager::resize($tmpfile, $path.(int)$matchId[$item[$identifier]].'-'.(int)$image->id.'.jpg');
|
||||
foreach ($imagesTypes AS $k => $imageType)
|
||||
imageResize($tmpfile, $path.(int)$matchId[$item[$identifier]].'-'.(int)$image->id.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']);
|
||||
ImageManager::resize($tmpfile, $path.(int)$matchId[$item[$identifier]].'-'.(int)$image->id.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']);
|
||||
}
|
||||
else
|
||||
foreach ($imagesTypes AS $k => $imageType)
|
||||
imageResize($tmpfile, $path.(int)$matchId[$item[$identifier]].'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']);
|
||||
foreach ($imagesTypes as $imageType)
|
||||
ImageManager::resize($tmpfile, $path.(int)$matchId[$item[$identifier]].'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']);
|
||||
}
|
||||
else
|
||||
@unlink($tmpfile);
|
||||
|
||||
@@ -113,7 +113,7 @@ class Watermark extends Module
|
||||
|
||||
if (isset($_FILES['PS_WATERMARK']['tmp_name']) AND !empty($_FILES['PS_WATERMARK']['tmp_name']))
|
||||
{
|
||||
if (!isPicture($_FILES['PS_WATERMARK'], array('image/gif')))
|
||||
if (!ImageManager::isRealImage($_FILES['PS_WATERMARK']['tmp_name'], $_FILES['PS_WATERMARK']['type'], array('image/gif')))
|
||||
$this->_postErrors[] = $this->l('Image must be in GIF format.');
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ class Watermark extends Module
|
||||
if (isset($_FILES['PS_WATERMARK']) AND !empty($_FILES['PS_WATERMARK']['tmp_name']))
|
||||
{
|
||||
/* Check watermark validity */
|
||||
if ($error = checkImage($_FILES['PS_WATERMARK']))
|
||||
if ($error = ImageManager::validateUpload($_FILES['PS_WATERMARK']))
|
||||
$this->_errors[] = $error;
|
||||
/* Copy new watermark */
|
||||
elseif(!copy($_FILES['PS_WATERMARK']['tmp_name'], dirname(__FILE__).'/watermark'.$str_shop.'.gif'))
|
||||
@@ -249,7 +249,7 @@ class Watermark extends Module
|
||||
foreach($this->imageTypes as $imageType)
|
||||
{
|
||||
$newFile = _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'-'.stripslashes($imageType['name']).'.jpg';
|
||||
if (!imageResize($file, $newFile, (int)$imageType['width'], (int)$imageType['height']))
|
||||
if (!ImageManager::resize($file, $newFile, (int)$imageType['width'], (int)$imageType['height']))
|
||||
$return = false;
|
||||
}
|
||||
return $return;
|
||||
|
||||
Reference in New Issue
Block a user