// ImageType is now applied to a them

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11700 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard
2011-12-22 21:48:40 +00:00
parent 5768a6c688
commit e8a3c10175
19 changed files with 1714 additions and 1717 deletions
+18 -4
View File
@@ -69,6 +69,13 @@ 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',
@@ -363,6 +370,8 @@ 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')
@@ -370,7 +379,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 (!imageResize($dir.$image, $newDir.substr($image, 0, -4).'-'.stripslashes($imageType['name']).$theme.'.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,14 +394,16 @@ 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']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
if (!imageResize($dir.$imageObj->getExistingImgPath().'.jpg', $dir.$imageObj->getExistingImgPath().'-'.stripslashes($imageType['name']).$theme.'.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;
}
@@ -401,15 +412,18 @@ 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']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
if (!imageResize($file, $dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).$theme.'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
$errors = true;
}
}
return $errors;
}