Skip to content

Commit

Permalink
Merge pull request #43 from elecena/gd-is-resource-checks
Browse files Browse the repository at this point in the history
ImageGD: imagecreatetruecolor returns false on errors
  • Loading branch information
macbre authored Jun 25, 2021
2 parents 92bc56f + 8fdbd72 commit b29e85e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions classes/utils/ImageGD.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public function scale($width, $height)
$height = round($this->height * $ratio);

// create new image
$thumb = ImageCreateTrueColor($width, $height);
$thumb = imagecreatetruecolor($width, $height);

if (!is_resource($thumb)) {
if ($thumb === false) {
return false;
}

Expand Down Expand Up @@ -98,9 +98,9 @@ public function crop($width, $height)
}

// create new image
$thumb = ImageCreateTrueColor($width, $height);
$thumb = imagecreatetruecolor($width, $height);

if (!is_resource($thumb)) {
if ($thumb === false) {
return false;
}

Expand Down

0 comments on commit b29e85e

Please sign in to comment.