aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Helper
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2019-05-10 16:52:01 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-05-10 16:52:01 +0200
commit844fd9fafc577faa8d6c8faa4e37b915be2389d9 (patch)
tree00bbdab87df426a541df33af15b6c4aa78b4b436 /src/Wallabag/CoreBundle/Helper
parent77bd7f690db45be10a32fe4ceebccdd0edf7c24f (diff)
downloadwallabag-844fd9fafc577faa8d6c8faa4e37b915be2389d9.tar.gz
wallabag-844fd9fafc577faa8d6c8faa4e37b915be2389d9.tar.zst
wallabag-844fd9fafc577faa8d6c8faa4e37b915be2389d9.zip
Fallback to default solution if Imagick fails
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper')
-rw-r--r--src/Wallabag/CoreBundle/Helper/DownloadImages.php13
1 files changed, 9 insertions, 4 deletions
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
137 case 'gif': 137 case 'gif':
138 // use Imagick if available to keep GIF animation 138 // use Imagick if available to keep GIF animation
139 if (class_exists('\\Imagick')) { 139 if (class_exists('\\Imagick')) {
140 $imagick = new \Imagick(); 140 try {
141 $imagick->readImageBlob($res->getBody()); 141 $imagick = new \Imagick();
142 $imagick->setImageFormat('gif'); 142 $imagick->readImageBlob($res->getBody());
143 $imagick->writeImages($localPath, true); 143 $imagick->setImageFormat('gif');
144 $imagick->writeImages($localPath, true);
145 } catch (\Exception $e) {
146 // if Imagick fail, fallback to the default solution
147 imagegif($im, $localPath);
148 }
144 } else { 149 } else {
145 imagegif($im, $localPath); 150 imagegif($im, $localPath);
146 } 151 }