mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-09 06:28:28 +03:00
Fix GD2 for #1009
This commit is contained in:
parent
dd74759adc
commit
f3845be39f
1 changed files with 4 additions and 3 deletions
|
|
@ -50,7 +50,8 @@ class GD2 implements \SnappyMail\Image
|
|||
}
|
||||
$gd2 = new static();
|
||||
$gd2->img = \imagecreatefromstring($data);
|
||||
if (!\is_resource($gd2->img)) {
|
||||
// resource or PHP8 GdImage
|
||||
if (!$gd2->img) {
|
||||
throw new \InvalidArgumentException('Failed to load image');
|
||||
}
|
||||
$gd2->file = 'blob';
|
||||
|
|
@ -223,7 +224,7 @@ class GD2 implements \SnappyMail\Image
|
|||
/** rotate clockwise */
|
||||
if (!\function_exists('imagerotate')) { require __DIR__ . '/gd2/imagerotate.inc'; }
|
||||
$tmp_img = \imagerotate($this->img, $degrees * -1, 0);
|
||||
if (!\is_resource($tmp_img)) { return false; }
|
||||
if (!$tmp_img) { return false; }
|
||||
\imagedestroy($this->img);
|
||||
$this->img = $tmp_img;
|
||||
return true;
|
||||
|
|
@ -240,7 +241,7 @@ class GD2 implements \SnappyMail\Image
|
|||
if (!$width || ($bestfit && $tx < $ty)) { $width = \round($x / $ty); }
|
||||
if (!$height || ($bestfit && $tx > $ty)) { $height = \round($y / $tx); }
|
||||
$tmp_img = $this->create_image($width, $height);
|
||||
if (!\is_resource($tmp_img)) { return false; }
|
||||
if (!$tmp_img) { return false; }
|
||||
\imagealphablending($tmp_img, false);
|
||||
if (!\imagecopyresampled($tmp_img, $this->img, 0, 0, 0, 0, $width, $height, $x, $y)) {
|
||||
if (!\imagecopyresized($tmp_img, $this->img, 0, 0, 0, 0, $width, $height, $x, $y)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue