From 4b6295b94a68c0a3dfd0b6c2f8f98445c6ed96a8 Mon Sep 17 00:00:00 2001 From: Rostislav Vitek Date: Thu, 7 Dec 2023 15:21:53 +0100 Subject: [PATCH] XML feeds: image URL is now always restricted to reasonable size (605px) --- .../ProductFeed/Mergado/FeedItem/MergadoFeedItemFactory.php | 5 +++-- .../Google/Model/FeedItem/GoogleFeedItemFactory.php | 2 +- .../Zbozi/Model/FeedItem/ZboziFeedItemFactory.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/Model/ProductFeed/Mergado/FeedItem/MergadoFeedItemFactory.php b/app/src/Model/ProductFeed/Mergado/FeedItem/MergadoFeedItemFactory.php index 62346215dc..cf330031a1 100644 --- a/app/src/Model/ProductFeed/Mergado/FeedItem/MergadoFeedItemFactory.php +++ b/app/src/Model/ProductFeed/Mergado/FeedItem/MergadoFeedItemFactory.php @@ -12,6 +12,7 @@ use Psr\Log\LoggerInterface; use Shopsys\FrameworkBundle\Component\Domain\Config\DomainConfig; use Shopsys\FrameworkBundle\Component\Image\Exception\ImageNotFoundException; +use Shopsys\FrameworkBundle\Model\Feed\FeedItemImageHelper; use Shopsys\FrameworkBundle\Model\Pricing\Currency\CurrencyFacade; use Shopsys\FrameworkBundle\Model\Pricing\Group\PricingGroupSettingFacade; use Shopsys\FrameworkBundle\Model\Product\Collection\ProductParametersBatchLoader; @@ -81,7 +82,7 @@ public function createForProduct(Product $product, DomainConfig $domainConfig): $flags, $availability, $product->getBrand(), - $this->productUrlsBatchLoader->getProductImageUrl($product, $domainConfig), + $this->productUrlsBatchLoader->getResizedProductImageUrl($product, $domainConfig), $product->isVariant() ? $product->getMainVariant()->getId() : null, ); } @@ -155,7 +156,7 @@ private function getOtherProductImages(Product $product, DomainConfig $domainCon foreach ($images as $image) { try { - $imageUrls[] = $this->imageFacade->getImageUrl($domainConfig, $image); + $imageUrls[] = FeedItemImageHelper::limitWidthInImageUrl($this->imageFacade->getImageUrl($domainConfig, $image)); } catch (ImageNotFoundException $exception) { $this->logger->error(sprintf('Image with id "%s" not found on filesystem', $image->getId())); } diff --git a/app/src/ProductFeed/Google/Model/FeedItem/GoogleFeedItemFactory.php b/app/src/ProductFeed/Google/Model/FeedItem/GoogleFeedItemFactory.php index 55e40105cc..436dc4fd92 100644 --- a/app/src/ProductFeed/Google/Model/FeedItem/GoogleFeedItemFactory.php +++ b/app/src/ProductFeed/Google/Model/FeedItem/GoogleFeedItemFactory.php @@ -33,7 +33,7 @@ public function create(Product $product, DomainConfig $domainConfig): GoogleFeed $product->getDescription($domainConfig->getId()), $product->getEan(), $product->getPartno(), - $this->productUrlsBatchLoader->getProductImageUrl($product, $domainConfig), + $this->productUrlsBatchLoader->getResizedProductImageUrl($product, $domainConfig), ); } } diff --git a/app/src/ProductFeed/Zbozi/Model/FeedItem/ZboziFeedItemFactory.php b/app/src/ProductFeed/Zbozi/Model/FeedItem/ZboziFeedItemFactory.php index 8b949f8837..06ccc65da9 100644 --- a/app/src/ProductFeed/Zbozi/Model/FeedItem/ZboziFeedItemFactory.php +++ b/app/src/ProductFeed/Zbozi/Model/FeedItem/ZboziFeedItemFactory.php @@ -64,7 +64,7 @@ public function create( $this->productParametersBatchLoader->getProductParametersByName($product, $domainConfig), $mainVariantId, $product->getDescription($domainConfig->getId()), - $this->productUrlsBatchLoader->getProductImageUrl($product, $domainConfig), + $this->productUrlsBatchLoader->getResizedProductImageUrl($product, $domainConfig), $this->getBrandName($product), $product->getEan(), $product->getPartno(),