Skip to content

Commit 0c07794

Browse files
committed
MAGETWO-65480: [Backport] - [Performance] Image metadata caching - for 2.1.6
1 parent ccd51d4 commit 0c07794

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/code/Magento/Catalog/Block/Product/ImageBlockBuilder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,17 @@ public function __construct(
6767
*
6868
* @param AssetImage $imageAsset
6969
* @return array
70+
* @throws \Exception
7071
*/
7172
private function getImageSize(AssetImage $imageAsset)
7273
{
7374
$imagePath = $imageAsset->getPath();
7475
$size = $this->sizeCache->load($imagePath);
7576
if (!$size) {
7677
$size = getimagesize($imagePath);
78+
if (!$size) {
79+
throw new \Exception('An error occurred while reading file: ' . $imagePath);
80+
}
7781
$this->sizeCache->save($size[0], $size[1], $imagePath);
7882
$size = ['width' => $size[0], 'height' => $size[1]];
7983
}

app/code/Magento/Catalog/Model/Product/Image/SizeCache.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ class SizeCache
2626

2727
public function __construct(
2828
CacheInterface $cacheManager
29-
)
30-
{
29+
) {
3130
$this->cacheManager = $cacheManager;
3231
}
3332

0 commit comments

Comments
 (0)