From f21a90e9f63c5cfd4dcbadfd2d8ce4e16d0e4fee Mon Sep 17 00:00:00 2001 From: Jaap den Hollander Date: Thu, 27 Jun 2024 09:48:59 +0200 Subject: [PATCH 1/2] SetImageResource receives the output from imagecreatetruecolor which can also be false or GdImage --- src/PhpPresentation/Shape/Drawing/Gd.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpPresentation/Shape/Drawing/Gd.php b/src/PhpPresentation/Shape/Drawing/Gd.php index 16fa6fe16..b7ba2e043 100644 --- a/src/PhpPresentation/Shape/Drawing/Gd.php +++ b/src/PhpPresentation/Shape/Drawing/Gd.php @@ -83,7 +83,7 @@ public function getImageResource() /** * Set image resource. * - * @param resource $value + * @param resource|false|\GdImage|null $value * * @return $this */ @@ -91,7 +91,7 @@ public function setImageResource($value = null) { $this->imageResource = $value; - if (null !== $this->imageResource) { + if (null !== $this->imageResource && false !== $value) { // Get width/height $this->width = imagesx($this->imageResource); $this->height = imagesy($this->imageResource); From 6db2665f08c1d2a9c79af4d86687b818e7f9e786 Mon Sep 17 00:00:00 2001 From: Jaap den Hollander Date: Thu, 27 Jun 2024 09:55:41 +0200 Subject: [PATCH 2/2] fix linter error --- src/PhpPresentation/Shape/Drawing/Gd.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PhpPresentation/Shape/Drawing/Gd.php b/src/PhpPresentation/Shape/Drawing/Gd.php index b7ba2e043..faaf9008d 100644 --- a/src/PhpPresentation/Shape/Drawing/Gd.php +++ b/src/PhpPresentation/Shape/Drawing/Gd.php @@ -19,6 +19,8 @@ namespace PhpOffice\PhpPresentation\Shape\Drawing; +use GdImage; + class Gd extends AbstractDrawingAdapter { // Rendering functions @@ -83,7 +85,7 @@ public function getImageResource() /** * Set image resource. * - * @param resource|false|\GdImage|null $value + * @param resource|false|GdImage|null $value * * @return $this */