From 25157156b37b5097e79ca89e9d322e22e5b19297 Mon Sep 17 00:00:00 2001 From: Sander Date: Wed, 4 Dec 2019 10:34:38 +0100 Subject: [PATCH] Fix cropping for images with height lower than requested folder height --- src/ForkCMS/Utility/Thumbnails.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ForkCMS/Utility/Thumbnails.php b/src/ForkCMS/Utility/Thumbnails.php index 01cfba93049..efd33d77ca9 100644 --- a/src/ForkCMS/Utility/Thumbnails.php +++ b/src/ForkCMS/Utility/Thumbnails.php @@ -86,6 +86,9 @@ private function generateThumbnail(array $folder, string $forSourceFile): void if ($box->getWidth() < $width) { $height = ($box->getHeight() / $box->getWidth()) * $width; $image = $image->resize(new Box($width, $height)); + } elseif ($box->getHeight() < $height) { + $width *= ($box->getWidth() / $box->getHeight()); + $image = $image->resize(new Box($width, $height)); } else { $image = $image->thumbnail(new Box($width, $height), ImageInterface::THUMBNAIL_OUTBOUND); }