// revert from r11699
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11702 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -89,7 +89,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
@@ -425,14 +425,11 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
{
|
||||
$images_types = ImageType::getImagesTypes('categories');
|
||||
foreach ($images_types as $k => $image_type)
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
|
||||
imageResize(
|
||||
_PS_CAT_IMG_DIR_.$id_category.'.jpg',
|
||||
_PS_CAT_IMG_DIR_.$id_category.'-'.stripslashes($image_type['name']).$theme.'.jpg',
|
||||
_PS_CAT_IMG_DIR_.$id_category.'-'.stripslashes($image_type['name']).'.jpg',
|
||||
(int)$image_type['width'], (int)$image_type['height']
|
||||
);
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -69,13 +69,6 @@ class AdminImagesControllerCore extends AdminController
|
||||
'title' => $this->l('Images'),
|
||||
'image' => '../img/admin/picture.gif'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Theme:'),
|
||||
'name' => 'theme',
|
||||
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
@@ -370,8 +363,6 @@ class AdminImagesControllerCore extends AdminController
|
||||
if (preg_match('/^[0-9]*\.jpg$/', $image))
|
||||
foreach ($type AS $k => $imageType)
|
||||
{
|
||||
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$imageType['id_theme'] : '');
|
||||
// Customizable writing dir
|
||||
$newDir = $dir;
|
||||
if ($imageType['name'] == 'thumb_scene')
|
||||
@@ -379,7 +370,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']).$theme.'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
|
||||
if (!imageResize($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';
|
||||
@@ -394,16 +385,14 @@ class AdminImagesControllerCore extends AdminController
|
||||
if (file_exists($dir.$imageObj->getExistingImgPath().'.jpg'))
|
||||
foreach ($type AS $k => $imageType)
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$imageType['id_theme'] : '');
|
||||
if (!file_exists($dir.$imageObj->getExistingImgPath().'-'.stripslashes($imageType['name']).'.jpg'))
|
||||
if (!imageResize($dir.$imageObj->getExistingImgPath().'.jpg', $dir.$imageObj->getExistingImgPath().'-'.stripslashes($imageType['name']).$theme.'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
|
||||
if (!imageResize($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';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
@@ -412,18 +401,15 @@ class AdminImagesControllerCore extends AdminController
|
||||
{
|
||||
$errors = false;
|
||||
foreach ($type AS $k => $imageType)
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$imageType['id_theme'] : '');
|
||||
foreach ($languages AS $language)
|
||||
{
|
||||
$file = $dir.$language['iso_code'].'.jpg';
|
||||
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']).$theme.'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
|
||||
if (!imageResize($file, $dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
|
||||
$errors = true;
|
||||
}
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
|
||||
@@ -700,10 +700,7 @@ class AdminImportControllerCore extends AdminController
|
||||
imageResize($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']);
|
||||
}
|
||||
imageResize($tmpfile, $path.'-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']);
|
||||
if (in_array($image_type['id_image_type'], $watermark_types))
|
||||
Hook::exec('watermark', array('id_image' => $id_image, 'id_product' => $id_entity));
|
||||
}
|
||||
|
||||
@@ -433,12 +433,11 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
$images_types = ImageType::getImagesTypes('products');
|
||||
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 (!imageResize($tmp_name, _PS_IMG_DIR_.'p/'.$language.'-default-'.stripslashes($image_type['name']).'.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 (!imageResize($tmp_name, _PS_IMG_DIR_.'c/'.$language.'-default-'.stripslashes($image_type['name']).'.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 (!imageResize($tmp_name, _PS_IMG_DIR_.'m/'.$language.'-default-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while resizing no-picture image to your manufacturer directory.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -683,15 +683,12 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
{
|
||||
$images_types = ImageType::getImagesTypes('manufacturers');
|
||||
foreach ($images_types as $k => $image_type)
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
|
||||
imageResize(
|
||||
_PS_MANU_IMG_DIR_.$id_manufacturer.'.jpg',
|
||||
_PS_MANU_IMG_DIR_.$id_manufacturer.'-'.stripslashes($image_type['name']).$theme.'.jpg',
|
||||
_PS_MANU_IMG_DIR_.$id_manufacturer.'-'.stripslashes($image_type['name']).'.jpg',
|
||||
(int)$image_type['width'],
|
||||
(int)$image_type['height']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->_defaultOrderBy = 'position';
|
||||
$this->max_file_size = (Configuration::get('PS_LIMIT_UPLOAD_IMAGE_VALUE') * 1000000);
|
||||
$this->max_image_size = (Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE') * 1000000);
|
||||
|
||||
|
||||
$categoriesArray = array();
|
||||
$categories = Category::getSimpleCategories($this->context->language->id);
|
||||
|
||||
@@ -1370,11 +1370,8 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
$imagesTypes = ImageType::getImagesTypes('products');
|
||||
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 (!imageResize($tmpName, $new_path.'-'.stripslashes($image_type['name']).'.'.$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']);
|
||||
}
|
||||
}
|
||||
|
||||
@unlink($tmpName);
|
||||
|
||||
@@ -74,11 +74,10 @@ class AdminScenesControllerCore extends AdminController
|
||||
$images_types = ImageType::getImagesTypes('scenes');
|
||||
foreach ($images_types as $k => $image_type)
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
|
||||
if ($image_type['name'] == 'large_scene' && isset($_FILES['image']))
|
||||
imageResize(
|
||||
$_FILES['image']['tmp_name'],
|
||||
_PS_SCENE_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).$theme.'.jpg',
|
||||
_PS_SCENE_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).'.jpg',
|
||||
(int)$image_type['width'],
|
||||
(int)$image_type['height']
|
||||
);
|
||||
@@ -90,7 +89,7 @@ class AdminScenesControllerCore extends AdminController
|
||||
$tmp_name = $_FILES['image']['tmp_name'];
|
||||
imageResize(
|
||||
$tmp_name,
|
||||
_PS_SCENE_THUMB_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).$theme.'.jpg',
|
||||
_PS_SCENE_THUMB_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).'.jpg',
|
||||
(int)$image_type['width'],
|
||||
(int)$image_type['height']
|
||||
);
|
||||
@@ -190,7 +189,7 @@ class AdminScenesControllerCore extends AdminController
|
||||
.(Tools::getMaxUploadSize() / 1024).''.$this->l('KB max.').' '
|
||||
.$this->l('If larger than the image size setting, the image will be reduced to ')
|
||||
.' '.$large_scene_image_type['width'].'x'.$large_scene_image_type['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
|
||||
.$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).');
|
||||
if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_.$obj->id.'-large_scene.jpg'))
|
||||
@@ -204,7 +203,7 @@ class AdminScenesControllerCore extends AdminController
|
||||
$image_to_map_desc .= '
|
||||
<div id="ajax_choose_product" style="display:none; padding:6px; padding-top:2px; width:600px;">
|
||||
'.$this->l('Begin typing the first letters of the product name, then select the product from the drop-down list:').'
|
||||
<br /><input type="text" value="" id="product_autocomplete_input" />
|
||||
<br /><input type="text" value="" id="product_autocomplete_input" />
|
||||
<input type="button" class="button" value="'.$this->l('OK').'" onclick="$(this).prev().search();" />
|
||||
<input type="button" class="button" value="'.$this->l('Delete').'" onclick="undoEdit();" />
|
||||
</div>
|
||||
|
||||
@@ -373,13 +373,10 @@ class AdminStoresControllerCore extends AdminController
|
||||
{
|
||||
$images_types = ImageType::getImagesTypes('stores');
|
||||
foreach ($images_types as $k => $image_type)
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
|
||||
imageResize(_PS_STORE_IMG_DIR_.$id_store.'.jpg',
|
||||
_PS_STORE_IMG_DIR_.$id_store.'-'.stripslashes($image_type['name']).$theme.'.jpg',
|
||||
_PS_STORE_IMG_DIR_.$id_store.'-'.stripslashes($image_type['name']).'.jpg',
|
||||
(int)$image_type['width'], (int)$image_type['height']
|
||||
);
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -306,8 +306,7 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
foreach ($images_types as $k => $image_type)
|
||||
{
|
||||
$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']);
|
||||
imageResize($file, _PS_SUPP_IMG_DIR_.$id_supplier.'-'.stripslashes($image_type['name']).'.jpg', (int)$image_type['width'], (int)$image_type['height']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user