[*] BO : Removed size limit for image upload (BL006, CC136)

This commit is contained in:
tDidierjean
2011-09-12 09:14:07 +00:00
parent beea76b0bd
commit 7cd878079c
17 changed files with 43 additions and 51 deletions
-2
View File
@@ -29,8 +29,6 @@ include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
class AdminCMSCategories extends AdminTab
{
protected $maxImageSize = 300000;
/** @var object CMSCategory() instance for navigation*/
private $_CMSCategory;
-2
View File
@@ -29,8 +29,6 @@ include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
class AdminCarriers extends AdminTab
{
protected $maxImageSize = 30000;
public function __construct()
{
$this->table = 'carrier';
-2
View File
@@ -27,8 +27,6 @@
class AdminCategories extends AdminTab
{
protected $maxImageSize = 300000;
/** @var object Category() instance for navigation*/
private $_category;
+1 -1
View File
@@ -66,7 +66,7 @@ class AdminLanguages extends AdminTab
public function copyNoPictureImage($language)
{
if (isset($_FILES['no-picture']) and $_FILES['no-picture']['error'] === 0)
if ($error = checkImage($_FILES['no-picture'], $this->maxImageSize))
if ($error = checkImage($_FILES['no-picture'], Tools::getMaxUploadSize()))
$this->_errors[] = $error;
else
{
-2
View File
@@ -27,8 +27,6 @@
class AdminManufacturers extends AdminTab
{
protected $maxImageSize = 200000;
/** @var array countries list */
private $countriesArray = array();
+3 -10
View File
@@ -28,8 +28,7 @@ include_once(PS_ADMIN_DIR.'/tabs/AdminProfiles.php');
class AdminProducts extends AdminTab
{
protected $maxImageSize = 2000000;
protected $maxFileSize = 10000000;
protected $maxFileSize = 20000000;
private $_category;
@@ -1009,12 +1008,6 @@ class AdminProducts extends AdminTab
if (!$image->add())
throw new Exception(Tools::displayError('Error while creating additional image'));
if (filesize($subdir.$file) > $this->maxImageSize)
{
$image->delete();
throw new Exception(Tools::displayError('Image is too large').' ('.(filesize($subdir.$file) / 1000).Tools::displayError('kB').'). '.Tools::displayError('Maximum allowed:').' '.($this->maxImageSize / 1000).Tools::displayError('kB'));
}
$ext = substr($file, -4);
$type = (isset($types[$ext]) ? $types[$ext] : '');
if (!isPicture(array('tmp_name' => $subdir.$file, 'type' => $type)))
@@ -1063,7 +1056,7 @@ class AdminProducts extends AdminTab
{
if (!isset($_FILES['image_product']['tmp_name']))
return false;
if ($error = checkImage($_FILES['image_product'], $this->maxImageSize))
if ($error = checkImage($_FILES['image_product']))
$this->_errors[] = $error;
else
{
@@ -2991,7 +2984,7 @@ class AdminProducts extends AdminTab
<td style="padding-bottom:5px;">
<input type="file" id="image_product" name="image_product" />
<p>
'.$this->l('Format:').' JPG, GIF, PNG. '.$this->l('Filesize:').' '.($this->maxImageSize / 1000).''.$this->l('Kb max.').'
'.$this->l('Format:').' JPG, GIF, PNG. '.$this->l('Filesize:').' '.(Tools::getMaxUploadSize() / 1024).''.$this->l('Kb max.').'
<br />'.$this->l('You can also upload a ZIP file containing several images. Thumbnails will be resized automatically.').'
</p>
</td>
+2 -4
View File
@@ -27,8 +27,6 @@
class AdminScenes extends AdminTab
{
protected $maxImageSize = 1000000;
public function __construct()
{
$this->table = 'scene';
@@ -192,7 +190,7 @@ class AdminScenes extends AdminTab
<div class="margin-form">
<input type="hidden" id="stay_here" name="stay_here" value="" />
<input type="file" name="image" id="image_input" /> <input type="button" value="'.$this->l('Upload image').'" onclick="{$(\'#stay_here\').val(\'true\');$(\'#scenesForm\').submit();}" class="button" /><br/>
<p>'.$this->l('Format:').' JPG, GIF, PNG. '.$this->l('File size:').' '.($this->maxImageSize / 1000).''.$this->l('KB max.').' '.$this->l('If larger than the image size setting, the image will be reduced to ').' '.$largeSceneImageType['width'].'x'.$largeSceneImageType['height'].'px '.$this->l('(width x height). If smaller than the image-size setting, a white background will be added in order to achieve the correct image size.').'.<br />'.$this->l('Note: To change image dimensions, please change the \'large_scene\' image type settings to the desired size (in Back Office > Preferences > Images).').'</p>';
<p>'.$this->l('Format:').' JPG, GIF, PNG. '.$this->l('File size:').' '.(Tools::getMaxUploadSize() / 1024).''.$this->l('KB max.').' '.$this->l('If larger than the image size setting, the image will be reduced to ').' '.$largeSceneImageType['width'].'x'.$largeSceneImageType['height'].'px '.$this->l('(width x height). If smaller than the image-size setting, a white background will be added in order to achieve the correct image size.').'.<br />'.$this->l('Note: To change image dimensions, please change the \'large_scene\' image type settings to the desired size (in Back Office > Preferences > Images).').'</p>';
if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_.$obj->id.'-large_scene.jpg'))
{
@@ -218,7 +216,7 @@ class AdminScenes extends AdminTab
echo '<label>'.$this->l('Alternative thumbnail:').' </label>
<div class="margin-form">
<input type="file" name="thumb" id="thumb_input" />&nbsp;&nbsp;'.$this->l('(optional)').'
<p>'.$this->l('If you want to use a thumbnail other than one generated from simply reducing the mapped image, please upload it here.').'<br />'.$this->l('Format:').' JPG, GIF, PNG. '.$this->l('Filesize:').' '.($this->maxImageSize / 1000).''.$this->l('Kb max.').' '.$this->l('Automatically resized to').' '.$thumbSceneImageType['width'].'x'.$thumbSceneImageType['height'].'px '.$this->l('(width x height)').'.<br />'.$this->l('Note: To change image dimensions, please change the \'thumb_scene\' image type settings to the desired size (in Back Office > Preferences > Images).').'</p>
<p>'.$this->l('If you want to use a thumbnail other than one generated from simply reducing the mapped image, please upload it here.').'<br />'.$this->l('Format:').' JPG, GIF, PNG. '.$this->l('Filesize:').' '.(Tools::getMaxUploadSize() / 1024).''.$this->l('Kb max.').' '.$this->l('Automatically resized to').' '.$thumbSceneImageType['width'].'x'.$thumbSceneImageType['height'].'px '.$this->l('(width x height)').'.<br />'.$this->l('Note: To change image dimensions, please change the \'thumb_scene\' image type settings to the desired size (in Back Office > Preferences > Images).').'</p>
';
if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_.'thumbs/'.$obj->id.'-thumb_scene.jpg'))
echo '<img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="'._THEME_SCENE_DIR_.'thumbs/'.$obj->id.'-thumb_scene.jpg" /><br />';
-2
View File
@@ -27,8 +27,6 @@
class AdminSuppliers extends AdminTab
{
protected $maxImageSize = 200000;
public function __construct()
{
$this->table = 'supplier';