Skip to content

Commit

Permalink
TASK: Optimize AssetImageSource
Browse files Browse the repository at this point in the history
- disallow upscalig
- calculate height with fallback to asset height when scaling if no target width is set
  • Loading branch information
mficzel committed Jul 13, 2018
1 parent 38fc106 commit 7cf7f44
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Classes/EelHelpers/AssetImageSourceHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit 7cf7f44

Please sign in to comment.