From: Jeremy Benoist Date: Fri, 10 May 2019 14:52:01 +0000 (+0200) Subject: Fallback to default solution if Imagick fails X-Git-Url: https://git.immae.eu/?p=github%2Fwallabag%2Fwallabag.git;a=commitdiff_plain;h=844fd9fafc577faa8d6c8faa4e37b915be2389d9 Fallback to default solution if Imagick fails --- diff --git a/src/Wallabag/CoreBundle/Helper/DownloadImages.php b/src/Wallabag/CoreBundle/Helper/DownloadImages.php index bc2afc64..9a7e9828 100644 --- a/src/Wallabag/CoreBundle/Helper/DownloadImages.php +++ b/src/Wallabag/CoreBundle/Helper/DownloadImages.php @@ -137,10 +137,15 @@ class DownloadImages case 'gif': // use Imagick if available to keep GIF animation if (class_exists('\\Imagick')) { - $imagick = new \Imagick(); - $imagick->readImageBlob($res->getBody()); - $imagick->setImageFormat('gif'); - $imagick->writeImages($localPath, true); + try { + $imagick = new \Imagick(); + $imagick->readImageBlob($res->getBody()); + $imagick->setImageFormat('gif'); + $imagick->writeImages($localPath, true); + } catch (\Exception $e) { + // if Imagick fail, fallback to the default solution + imagegif($im, $localPath); + } } else { imagegif($im, $localPath); }