2
0
Fork 0
forked from flashii/eeprom

Fixed thumbnailing.

This commit is contained in:
flash 2022-07-06 18:52:45 +00:00
parent c0b866742d
commit 4ecb410b3c

View file

@ -378,11 +378,11 @@ final class Upload implements JsonSerializable {
$height = $imagick->getImageHeight(); $height = $imagick->getImageHeight();
if ($width > $height) { if ($width > $height) {
$resizeWidth = $width * $thumbRes / $height; $resizeWidth = ceil($width * $thumbRes / $height);
$resizeHeight = $thumbRes; $resizeHeight = $thumbRes;
} else { } else {
$resizeWidth = $thumbRes; $resizeWidth = $thumbRes;
$resizeHeight = $height * $thumbRes / $width; $resizeHeight = ceil($height * $thumbRes / $width);
} }
$imagick->resizeImage( $imagick->resizeImage(
@ -393,8 +393,8 @@ final class Upload implements JsonSerializable {
$imagick->cropImage( $imagick->cropImage(
$thumbRes, $thumbRes,
$thumbRes, $thumbRes,
($resizeWidth - $thumbRes) / 2, ceil(($resizeWidth - $thumbRes) / 2),
($resizeHeight - $thumbRes) / 2 ceil(($resizeHeight - $thumbRes) / 2)
); );
$imagick->writeImage($this->getThumbPath()); $imagick->writeImage($this->getThumbPath());