Merge pull request #10144 from annando/catch-imagick-error

Catch Imagick errors
This commit is contained in:
Hypolite Petovan 2021-04-12 12:04:29 -04:00 committed by GitHub
commit 0b239f368b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -230,9 +230,13 @@ class Image
} }
if ($this->isImagick()) { if ($this->isImagick()) {
/* Clean it */ try {
$this->image = $this->image->deconstructImages(); /* Clean it */
return $this->image; $this->image = $this->image->deconstructImages();
return $this->image;
} catch (Exception $e) {
return false;
}
} }
return $this->image; return $this->image;
} }
@ -676,10 +680,14 @@ class Image
} }
if ($this->isImagick()) { if ($this->isImagick()) {
/* Clean it */ try {
$this->image = $this->image->deconstructImages(); /* Clean it */
$string = $this->image->getImagesBlob(); $this->image = $this->image->deconstructImages();
return $string; $string = $this->image->getImagesBlob();
return $string;
} catch (Exception $e) {
return false;
}
} }
ob_start(); ob_start();