Skip to content

Commit

Permalink
XML feeds: image URL is now always restricted to reasonable size (605px)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitek-rostislav committed Dec 7, 2023
1 parent 432c867 commit 4b6295b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
);
}
Expand Down Expand Up @@ -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()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 4b6295b

Please sign in to comment.