Reorder image resizing operations

This commit is contained in:
Visman 2019-11-20 16:51:41 +07:00
parent 308704023b
commit 4c2c686d3e

View file

@ -88,12 +88,12 @@ class Image extends File
if ($palette > 0 && ! \imagetruecolortopalette($image, true, $palette)) {
throw new FileException('Failed to convert image to palette');
}
if (false === \imagecopyresampled($image, $this->image, 0, 0, 0, 0, $width, $height, $oldW, $oldH)) {
throw new FileException('Failed to resize image');
}
if (false === \imagealphablending($image, false) || false === \imagesavealpha($image, true)) {
throw new FileException('Failed to adjust image');
}
if (false === \imagecopyresampled($image, $this->image, 0, 0, 0, 0, $width, $height, $oldW, $oldH)) {
throw new FileException('Failed to resize image');
}
$this->image = $image;