diff --git a/src/Upload.php b/src/Upload.php index 7aef6dd..25b2dbe 100644 --- a/src/Upload.php +++ b/src/Upload.php @@ -378,11 +378,11 @@ final class Upload implements JsonSerializable { $height = $imagick->getImageHeight(); if ($width > $height) { - $resizeWidth = $width * $thumbRes / $height; + $resizeWidth = ceil($width * $thumbRes / $height); $resizeHeight = $thumbRes; } else { $resizeWidth = $thumbRes; - $resizeHeight = $height * $thumbRes / $width; + $resizeHeight = ceil($height * $thumbRes / $width); } $imagick->resizeImage( @@ -393,8 +393,8 @@ final class Upload implements JsonSerializable { $imagick->cropImage( $thumbRes, $thumbRes, - ($resizeWidth - $thumbRes) / 2, - ($resizeHeight - $thumbRes) / 2 + ceil(($resizeWidth - $thumbRes) / 2), + ceil(($resizeHeight - $thumbRes) / 2) ); $imagick->writeImage($this->getThumbPath());