[*] Classes : images.inc.php functions are now all deprecated, use the new class ImageManager instead
This commit is contained in:
@@ -1083,7 +1083,7 @@ abstract class AdminTabCore
|
||||
|
||||
// Check image validity
|
||||
$max_size = isset($this->maxImageSize) ? $this->maxImageSize : 0;
|
||||
if ($error = checkImage($_FILES[$name], Tools::getMaxUploadSize($max_size)))
|
||||
if ($error = ImageManager::validateUpload($_FILES[$name], Tools::getMaxUploadSize($max_size)))
|
||||
$this->_errors[] = $error;
|
||||
elseif (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') || !move_uploaded_file($_FILES[$name]['tmp_name'], $tmpName))
|
||||
return false;
|
||||
@@ -1091,7 +1091,7 @@ abstract class AdminTabCore
|
||||
{
|
||||
$tmpName = $_FILES[$name]['tmp_name'];
|
||||
// Copy new image
|
||||
if (!imageResize($tmpName, _PS_IMG_DIR_.$dir.$id.'.'.$this->imageType, (int)$width, (int)$height, ($ext ? $ext : $this->imageType)))
|
||||
if (!ImageManager::resize($tmpName, _PS_IMG_DIR_.$dir.$id.'.'.$this->imageType, (int)$width, (int)$height, ($ext ? $ext : $this->imageType)))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while uploading image.');
|
||||
if (count($this->_errors))
|
||||
return false;
|
||||
@@ -1374,7 +1374,7 @@ abstract class AdminTabCore
|
||||
if ($id && file_exists($image))
|
||||
echo '
|
||||
<div id="image" >
|
||||
'.cacheImage($image, $this->table.'_'.(int)($id).'.'.$this->imageType, $size, $this->imageType, $disableCache).'
|
||||
'.ImageManager::thumbnail($image, $this->table.'_'.(int)($id).'.'.$this->imageType, $size, $this->imageType, $disableCache).'
|
||||
<p align="center">'.$this->l('File size').' '.(filesize($image) / 1000).'kb</p>
|
||||
<a href="'.self::$currentIndex.'&'.$this->identifier.'='.(int)($id).'&token='.$token.($id_image ? '&id_image='.(int)($id_image) : '').'&deleteImage=1">
|
||||
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete').'" /> '.$this->l('Delete').'</a>
|
||||
@@ -1683,7 +1683,7 @@ abstract class AdminTabCore
|
||||
}else
|
||||
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.$item_id.(isset($tr['id_image']) ? '-'.(int)($tr['id_image']) : '').'.'.$this->imageType;
|
||||
|
||||
echo cacheImage($path_to_image, $this->table.'_mini_'.$item_id.'.'.$this->imageType, 45, $this->imageType);
|
||||
echo ImageManager::thumbnail($path_to_image, $this->table.'_mini_'.$item_id.'.'.$this->imageType, 45, $this->imageType);
|
||||
}
|
||||
elseif (isset($params['icon']) && (isset($params['icon'][$tr[$key]]) || isset($params['icon']['default'])))
|
||||
echo '<img src="../img/admin/'.(isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default'].'" alt="'.$tr[$key]).'" title="'.$tr[$key].'" />';
|
||||
|
||||
Reference in New Issue
Block a user