diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 3cd00a4e..11e85a1e 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -32,7 +32,7 @@ jobs: if: github.event_name == 'push' steps: - name: Download artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: ${{ github.event.repository.name }} path: ${{ github.event.repository.name }} diff --git a/src/Commands/Image/ImageGenerateAbstract.php b/src/Commands/Image/ImageGenerateAbstract.php index 88cf3478..0644a529 100644 --- a/src/Commands/Image/ImageGenerateAbstract.php +++ b/src/Commands/Image/ImageGenerateAbstract.php @@ -302,22 +302,31 @@ protected function regenerateNewImages(string $dir, array $type, bool $productsI if (file_exists($existing_img) && filesize($existing_img)) { foreach ($type as $imageType) { if (!file_exists($dir . $imageObj->getExistingImgPath() . '-' . stripslashes($imageType['name']) . '.jpg')) { - if (!ImageManager::resize($existing_img, $dir . $imageObj->getExistingImgPath() . '-' . stripslashes($imageType['name']) . '.jpg', (int) $imageType['width'], (int) $imageType['height'])) { - $this->errors[] = sprintf( - 'Original image is corrupt %s for product ID %s or bad permission on folder.', - $existing_img, - (int) $imageObj->id_product - ); - } - - if ($generate_hight_dpi_images) { - if (!ImageManager::resize($existing_img, $dir . $imageObj->getExistingImgPath() . '-' . stripslashes($imageType['name']) . '2x.jpg', (int) $imageType['width'] * 2, (int) $imageType['height'] * 2)) { + try { + if (!ImageManager::resize($existing_img, $dir . $imageObj->getExistingImgPath() . '-' . stripslashes($imageType['name']) . '.jpg', (int) $imageType['width'], (int) $imageType['height'])) { $this->errors[] = sprintf( 'Original image is corrupt %s for product ID %s or bad permission on folder.', $existing_img, (int) $imageObj->id_product ); } + + if ($generate_hight_dpi_images) { + if (!ImageManager::resize($existing_img, $dir . $imageObj->getExistingImgPath() . '-' . stripslashes($imageType['name']) . '2x.jpg', (int) $imageType['width'] * 2, (int) $imageType['height'] * 2)) { + $this->errors[] = sprintf( + 'Original image is corrupt %s for product ID %s or bad permission on folder.', + $existing_img, + (int) $imageObj->id_product + ); + } + } + } catch (\Exception $e) { + $this->errors[] = sprintf( + 'Unable to resize image %s for product ID %s. error: %s', + $existing_img, + (int) $imageObj->id_product, + $e->getMessage() + ); } } }