Skip to content

Commit

Permalink
Merge pull request #32597 from M0rgan01/fix/32404
Browse files Browse the repository at this point in the history
Update checkOrGenerateImageType $sourceFilePath
  • Loading branch information
mflasquin committed Jul 18, 2023
2 parents a81305e + 726a22e commit f0a6b51
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/Adapter/Image/ImageRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,6 @@ public function getImage($object, $id_image)
// Obsolete solution, will be removed
$generateHighDpiImages = (bool) Configuration::get('PS_HIGHT_DPI');

// Get path of original uploaded image we will use to get thumbnails (original image extension is always .jpg)
$originalImagePath = implode(DIRECTORY_SEPARATOR, [
$imageFolderPath,
$id_image . '.jpg',
]);

/*
* Let's resolve which formats we will use for image generation.
* In new image system, it's multiple formats. In case of legacy, it's only .jpg.
Expand All @@ -214,6 +208,19 @@ public function getImage($object, $id_image)
$image_types = ImageType::getImagesTypes($type, true);
foreach ($image_types as $image_type) {
$sources = [];
$formattedName = ImageType::getFormattedName('small');

if ($type === 'categories' && $formattedName === $image_type['name']) {
$originalFileName = $id_image . '_thumb.jpg';
} else {
$originalFileName = $id_image . '.jpg';
}

// Get path of original uploaded image we will use to get thumbnails (original image extension is always .jpg)
$originalImagePath = implode(DIRECTORY_SEPARATOR, [
$imageFolderPath,
$originalFileName,
]);

foreach ($configuredImageFormats as $imageFormat) {
// Generate the thumbnail and optionally a high DPI version
Expand Down

0 comments on commit f0a6b51

Please sign in to comment.