Skip to content

Commit 1fd60db

Browse files
committed
feat: Add cache when loading svg image
1 parent 18068dd commit 1fd60db

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Model/Resize.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ public function resizeAndGetUrl(string $imagePath, $width, $height, array $resiz
220220
/** @var string[] $imagePathPart */
221221
$imagePathPart = pathinfo($imagePath);
222222
if ($imagePathPart['extension'] === 'svg') {
223-
return $this->storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_MEDIA) . $this->relativeFilename;
223+
$resultUrl = $this->storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_MEDIA) . $this->relativeFilename;
224+
$this->cache->save($resultUrl, $cacheKey, [self::CACHE_TAG_IDENTIFIER]);
224225
}
225226

226227
$this->initSize($width, $height);

0 commit comments

Comments
 (0)