From ecb42bcc6d1b36d72d17854d2ac68523b72a590d Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Fri, 22 Jul 2011 19:53:22 +1000 Subject: [PATCH] ImageMagick invalid image handling --- inc/image.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inc/image.php b/inc/image.php index d6ad9a07..b4226022 100644 --- a/inc/image.php +++ b/inc/image.php @@ -142,7 +142,12 @@ $this->image = new Imagick(); } public function from() { - $this->image->readImage($this->src); + try { + $this->image->readImage($this->src); + } catch(ImagickException $e) { + // invalid image + $this->image = false; + } } public function to($src) { $this->image->writeImage($src);