// Changed image system to new default + #PSCFV-4068
This commit is contained in:
+3
-3
@@ -594,9 +594,9 @@ class ImageCore extends ObjectModel
|
||||
// image exists in DB and with the correct product?
|
||||
if (Validate::isLoadedObject($image) && $image->id_product == (int)rtrim($matches[1], '-'))
|
||||
{
|
||||
// create the new folder if it does not exist
|
||||
if (!$image->createImgFolder())
|
||||
return false;
|
||||
// create the new folder if it does not exist
|
||||
if (!$image->createImgFolder())
|
||||
return false;
|
||||
|
||||
// if there's already a file at the new image path, move it to a dump folder
|
||||
// most likely the preexisting image is a demo image not linked to a product and it's ok to replace it
|
||||
|
||||
@@ -208,7 +208,7 @@ class HelperListCore extends Helper
|
||||
|
||||
if (method_exists($this->context->controller, $method_name))
|
||||
$this->_list[$index][$action] = $this->context->controller->$method_name($this->token, $id, $name);
|
||||
else if (method_exists($this, $method_name))
|
||||
elseif (method_exists($this, $method_name))
|
||||
$this->_list[$index][$action] = $this->$method_name($this->token, $id, $name);
|
||||
}
|
||||
}
|
||||
@@ -236,9 +236,9 @@ class HelperListCore extends Helper
|
||||
Tools::getValue('id_product')
|
||||
);
|
||||
}
|
||||
else if (isset($params['activeVisu']))
|
||||
elseif (isset($params['activeVisu']))
|
||||
$this->_list[$index][$key] = (bool)$tr[$key];
|
||||
else if (isset($params['position']))
|
||||
elseif (isset($params['position']))
|
||||
{
|
||||
$this->_list[$index][$key] = array(
|
||||
'position' => $tr[$key],
|
||||
@@ -252,14 +252,17 @@ class HelperListCore extends Helper
|
||||
'&way=0&position='.((int)$tr['position'] - 1).'&token='.$this->token
|
||||
);
|
||||
}
|
||||
else if (isset($params['image']))
|
||||
elseif (isset($params['image']))
|
||||
{
|
||||
// item_id is the product id in a product image context, else it is the image id.
|
||||
$item_id = isset($params['image_id']) ? $tr[$params['image_id']] : $id;
|
||||
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.$item_id.(isset($tr['id_image']) ? '-'.(int)$tr['id_image'] : '').'.'.$this->imageType;
|
||||
if ($params['image'] != 'p' || Configuration::get('PS_LEGACY_IMAGES'))
|
||||
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.$item_id.(isset($tr['id_image']) ? '-'.(int)$tr['id_image'] : '').'.'.$this->imageType;
|
||||
else
|
||||
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.Image::getImgFolderStatic($tr['id_image']).(int)$tr['id_image'].'.'.$this->imageType;
|
||||
$this->_list[$index][$key] = ImageManager::thumbnail($path_to_image, $this->table.'_mini_'.$item_id.'.'.$this->imageType, 45, $this->imageType);
|
||||
}
|
||||
else if (isset($params['icon']) && (isset($params['icon'][$tr[$key]]) || isset($params['icon']['default'])))
|
||||
elseif (isset($params['icon']) && (isset($params['icon'][$tr[$key]]) || isset($params['icon']['default'])))
|
||||
{
|
||||
if (isset($params['icon'][$tr[$key]]) && is_array($params['icon'][$tr[$key]]))
|
||||
$this->_list[$index][$key] = array(
|
||||
@@ -272,18 +275,18 @@ class HelperListCore extends Helper
|
||||
'alt' => isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default'],
|
||||
);
|
||||
}
|
||||
else if (isset($params['type']) && $params['type'] == 'float')
|
||||
elseif (isset($params['type']) && $params['type'] == 'float')
|
||||
$this->_list[$index][$key] = rtrim(rtrim($tr[$key], '0'), '.');
|
||||
else if (isset($params['type']) && $params['type'] == 'price')
|
||||
elseif (isset($params['type']) && $params['type'] == 'price')
|
||||
{
|
||||
$currency = (isset($params['currency']) && $params['currency']) ? Currency::getCurrencyInstance($tr['id_currency']) : $this->context->currency;
|
||||
$this->_list[$index][$key] = Tools::displayPrice($tr[$key], $currency, false);
|
||||
}
|
||||
else if (isset($params['type']) && $params['type'] == 'date')
|
||||
elseif (isset($params['type']) && $params['type'] == 'date')
|
||||
$this->_list[$index][$key] = Tools::displayDate($tr[$key], $this->context->language->id);
|
||||
else if (isset($params['type']) && $params['type'] == 'datetime')
|
||||
elseif (isset($params['type']) && $params['type'] == 'datetime')
|
||||
$this->_list[$index][$key] = Tools::displayDate($tr[$key], $this->context->language->id, true);
|
||||
else if (isset($tr[$key]))
|
||||
elseif (isset($tr[$key]))
|
||||
{
|
||||
$echo = $tr[$key];
|
||||
if (isset($params['callback']))
|
||||
|
||||
@@ -611,6 +611,7 @@ class InstallXmlLoader
|
||||
$this->setError($this->language->l('Cannot create image "%1$s" for entity "%2$s"', $identifier.'-'.$type['name'], $entity));
|
||||
}
|
||||
}
|
||||
Image::moveToNewFileSystem();
|
||||
}
|
||||
|
||||
public function copyImagesScene($identifier, array $data)
|
||||
|
||||
@@ -393,7 +393,7 @@
|
||||
<value>12</value>
|
||||
</configuration>
|
||||
<configuration id="PS_LEGACY_IMAGES" name="PS_LEGACY_IMAGES">
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
</configuration>
|
||||
<configuration id="PS_IMAGE_QUALITY" name="PS_IMAGE_QUALITY">
|
||||
<value>jpg</value>
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
die;
|
||||
foreach (scandir('.') as $dir)
|
||||
if ($dir[0] != '.')
|
||||
foreach (scandir($dir) as $file)
|
||||
{
|
||||
if ($file[0] == '.')
|
||||
continue;
|
||||
$name = $file;
|
||||
foreach (array('small', 'large', 'medium', 'thickbox', 'category', 'home') as $type)
|
||||
$name = str_replace($type, $type.'_default', $name);
|
||||
$name = str_replace('large_scene', 'scene_default', $name);
|
||||
$name = str_replace('thumb_scene', 'm_scene_default', $name);
|
||||
|
||||
echo($dir.'/'.$file);
|
||||
echo($dir.'/'.$name);
|
||||
rename($dir.'/'.$file, $dir.'/'.$name);
|
||||
}
|
||||
Reference in New Issue
Block a user