diff --git a/classes/Image.php b/classes/Image.php index 66e4bb614..8559d2ca0 100644 --- a/classes/Image.php +++ b/classes/Image.php @@ -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 diff --git a/classes/helper/HelperList.php b/classes/helper/HelperList.php index 953c52af5..36c2786a3 100644 --- a/classes/helper/HelperList.php +++ b/classes/helper/HelperList.php @@ -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'])) diff --git a/install-dev/classes/xmlLoader.php b/install-dev/classes/xmlLoader.php index c089ba868..0e460fc00 100644 --- a/install-dev/classes/xmlLoader.php +++ b/install-dev/classes/xmlLoader.php @@ -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) diff --git a/install-dev/data/xml/configuration.xml b/install-dev/data/xml/configuration.xml index 49efa0cf0..561c1ff63 100644 --- a/install-dev/data/xml/configuration.xml +++ b/install-dev/data/xml/configuration.xml @@ -393,7 +393,7 @@ 12 - 1 + 0 jpg diff --git a/install-dev/fixtures/apple/img/plop.php b/install-dev/fixtures/apple/img/plop.php deleted file mode 100644 index d25fd3da6..000000000 --- a/install-dev/fixtures/apple/img/plop.php +++ /dev/null @@ -1,18 +0,0 @@ -