From 7cf7f447ce2865250324f01e108339c5c0213cb7 Mon Sep 17 00:00:00 2001 From: Martin Ficzel Date: Fri, 13 Jul 2018 17:41:20 +0200 Subject: [PATCH] TASK: Optimize AssetImageSource - disallow upscalig - calculate height with fallback to asset height when scaling if no target width is set --- Classes/EelHelpers/AssetImageSourceHelper.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Classes/EelHelpers/AssetImageSourceHelper.php b/Classes/EelHelpers/AssetImageSourceHelper.php index baf8fa2..6d618af 100644 --- a/Classes/EelHelpers/AssetImageSourceHelper.php +++ b/Classes/EelHelpers/AssetImageSourceHelper.php @@ -75,6 +75,8 @@ public function scale(float $factor): ImageSourceHelperInterface if ($this->targetHeight) { $scaledHelper->setHeight(round($factor * $this->targetHeight)); + } else if (!$this->targetWidth) { + $scaledHelper->setHeight(round($factor * $this->asset->getHeight())); } return $scaledHelper; @@ -84,7 +86,7 @@ public function src(): string { $async = $this->request ? $this->async : false; $allowCropping = ($this->targetWidth && $this->targetHeight); - $allowUpScaling = true; + $allowUpScaling = false; $thumbnailConfiguration = new ThumbnailConfiguration( $this->targetWidth,