Fixed thumbnailing.
This commit is contained in:
parent
c0b866742d
commit
4ecb410b3c
1 changed files with 4 additions and 4 deletions
|
@ -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());
|
||||||
|
|
Loading…
Reference in a new issue