Skip to content

Commit 25651fa

Browse files
authored
[shopsys] moved Persoo feeds to Luigi's Box feeds (#3014)
2 parents 6bab466 + 18c31da commit 25651fa

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Shopsys\FrameworkBundle\Component\Image;
6+
7+
class ImageUrlWithSizeHelper
8+
{
9+
protected const DEFAULT_IMAGE_SIZE = 605;
10+
11+
/**
12+
* @param string $imageUrl
13+
* @param int|null $width
14+
* @param int|null $height
15+
* @return string
16+
*/
17+
public static function limitSizeInImageUrl(string $imageUrl, ?int $width = null, ?int $height = null): string
18+
{
19+
return $imageUrl . '?width=' . ($width ?? static::DEFAULT_IMAGE_SIZE) . ($height !== null ? '&height=' . $height : '');
20+
}
21+
}

src/Model/Feed/FeedItemImageHelper.php

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/Model/Product/Collection/ProductUrlsBatchLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Shopsys\FrameworkBundle\Model\Product\Collection;
66

77
use Shopsys\FrameworkBundle\Component\Domain\Config\DomainConfig;
8-
use Shopsys\FrameworkBundle\Model\Feed\FeedItemImageHelper;
8+
use Shopsys\FrameworkBundle\Component\Image\ImageUrlWithSizeHelper;
99
use Shopsys\FrameworkBundle\Model\Product\Collection\Exception\ProductImageUrlNotLoadedException;
1010
use Shopsys\FrameworkBundle\Model\Product\Collection\Exception\ProductUrlNotLoadedException;
1111
use Shopsys\FrameworkBundle\Model\Product\Product;
@@ -92,7 +92,7 @@ public function getResizedProductImageUrl(Product $product, DomainConfig $domain
9292
{
9393
$imageUrl = $this->getProductImageUrl($product, $domainConfig);
9494

95-
return $imageUrl !== null ? FeedItemImageHelper::limitWidthInImageUrl($imageUrl) : null;
95+
return $imageUrl !== null ? ImageUrlWithSizeHelper::limitSizeInImageUrl($imageUrl) : null;
9696
}
9797

9898
/**

0 commit comments

Comments
 (0)