Skip to content

Commit

Permalink
🐛 (sampling logic) fixes conditionals and removes buggy resample call
Browse files Browse the repository at this point in the history
  • Loading branch information
davejtoews committed Jun 16, 2023
1 parent ed77155 commit 2bf54a6
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/LazyFocusFitImageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,22 +179,21 @@ private function croppedImage($size)
if ($this->owner->AspectRatio) {
if ($this->owner->AspectRatio > $originalRatio) {
$scaledImage = $this->owner
->Resampled()
->FocusCropHeight(round($this->owner->Width / $this->owner->AspectRatio))
->ScaleMaxWidth($size);
} else {
$scaledImage = $this->owner
->FocusCropWidth(round($this->owner->Height * $this->owner->AspectRatio))
->ScaleMaxWidth($size);
}
$scaledImage = $this->owner
->Resampled()
->FocusCropWidth(round($this->owner->Height * $this->owner->AspectRatio))
->ScaleMaxWidth($size);
} else {
$scaledImage = $this->owner->ScaleMaxWidth($size);
}
}

$scaledImage = $this->owner->Resampled()->ScaleMaxWidth($size);

return ($this->owner->config()->get('default_webp') || $this->owner->serveWebP)
? $scaledImage->Webp()
: $scaledImage;
return ($this->owner->config()->get('default_webp') || $this->owner->serveWebP)
? $scaledImage->Webp()
: $scaledImage;
}
}

public function AutoSizes()
Expand Down

0 comments on commit 2bf54a6

Please sign in to comment.