diff --git a/classes/ThumbHash.php b/classes/ThumbHash.php index c038c8e..2c42f9f 100644 --- a/classes/ThumbHash.php +++ b/classes/ThumbHash.php @@ -37,8 +37,8 @@ public static function encode(Asset|File $file, array $options = []): string // Generate a sample image for encode to avoid memory issues. $max = $kirby->option('tobimori.thumbhash.sampleMaxSize'); // Max width or height - $height = round($file->height() > $file->width() ? $max : $max / $options['ratio']); - $width = round($file->width() > $file->height() ? $max : $max * $options['ratio']); + $height = round($options['ratio'] < 1 ? $max : $max / $options['ratio']); + $width = round($options['ratio'] >= 1 ? $max : $max * $options['ratio']); $options = [ 'width' => $width, 'height' => $height,