From 8da6516b774f9da503a4217d41026f6338a729d8 Mon Sep 17 00:00:00 2001 From: Evgeny Levinsky Date: Thu, 7 Mar 2024 16:32:34 -0600 Subject: [PATCH 1/2] Resolved exception in case origin image found but hashes aren't same --- Console/Command/RemoveMediaDuplicates.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Console/Command/RemoveMediaDuplicates.php b/Console/Command/RemoveMediaDuplicates.php index 10a0ad6..6b0ba39 100644 --- a/Console/Command/RemoveMediaDuplicates.php +++ b/Console/Command/RemoveMediaDuplicates.php @@ -81,14 +81,16 @@ protected function execute(InputInterface $input, OutputInterface $output) $duplicateImage = $this->imageBuilder->create($image->getValue()); $originImage = $this->originFinder->getOriginImage($duplicateImage); - if (!$this->isDryRun($input)) { - $this->imageResource->save( - $image->setValue($originImage->getCatalogPath()) - ); + if ($originImage) { + if (!$this->isDryRun($input)) { + $this->imageResource->save( + $image->setValue($originImage->getCatalogPath()) + ); + } + + $removedImages[] = $duplicateImage; + $totalSize += $duplicateImage->getFileSize(); } - - $removedImages[] = $duplicateImage; - $totalSize += $duplicateImage->getFileSize(); } catch (\Exception $exception) { $this->logger->error($exception->getMessage()); } From 0b606ba103cdcb2d78ffe5292a24a4fb447d8cd5 Mon Sep 17 00:00:00 2001 From: Evgeny Levinsky Date: Thu, 7 Mar 2024 16:40:26 -0600 Subject: [PATCH 2/2] Added information badges to extension readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 00585e9..c773a24 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +[![Latest Stable Version](http://poser.pugx.org/elevinskii/module-media-storage/v)](https://packagist.org/packages/elevinskii/module-media-storage) +[![Total Downloads](http://poser.pugx.org/elevinskii/module-media-storage/downloads)](https://packagist.org/packages/elevinskii/module-media-storage) +[![PHP Version Require](http://poser.pugx.org/elevinskii/module-media-storage/require/php)](https://packagist.org/packages/elevinskii/module-media-storage) + ### What's the problem? That sometimes might be a case when your Magento content managers use the same images with assigning them to