diff --git a/Classes/Domain/AssetImageSource.php b/Classes/Domain/AssetImageSource.php index ca3c244..8aa9335 100644 --- a/Classes/Domain/AssetImageSource.php +++ b/Classes/Domain/AssetImageSource.php @@ -45,6 +45,13 @@ class AssetImageSource extends AbstractScalableImageSource */ protected $request; + /** + * Runtime cache for the src uri for the asset. + * + * @var string|null + */ + private $srcCache = null; + /** * @param ImageInterface $asset * @param string|null $title @@ -112,6 +119,10 @@ public function src(): string return ''; } + if ($this->srcCache !== null) { + return $this->srcCache; + } + $width = $this->getCurrentWidth(); $height = $this->getCurrentHeight(); @@ -136,11 +147,14 @@ public function src(): string $this->request ); - if ($thumbnailData === null) { - return ''; - } + $this->srcCache = ($thumbnailData === null) ? '' : $thumbnailData['src']; - return $thumbnailData['src']; + return $this->srcCache; + } + + public function __clone(): void + { + $this->srcCache = null; } public function dataSrc(): string