]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Helper/DownloadImages.php
Merge remote-tracking branch 'origin/master' into 2.4
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Helper / DownloadImages.php
index bc2afc646cb79819ac05a9574ef96fe68afa7ba7..9a7e9828594492bca5bb8286e82e7f31da8f3763 100644 (file)
@@ -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);
                 }