aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Helper/DownloadImages.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/DownloadImages.php b/src/Wallabag/CoreBundle/Helper/DownloadImages.php
index cc3dcfce..9a7e9828 100644
--- a/src/Wallabag/CoreBundle/Helper/DownloadImages.php
+++ b/src/Wallabag/CoreBundle/Helper/DownloadImages.php
@@ -135,7 +135,21 @@ class DownloadImages
135 135
136 switch ($ext) { 136 switch ($ext) {
137 case 'gif': 137 case 'gif':
138 imagegif($im, $localPath); 138 // use Imagick if available to keep GIF animation
139 if (class_exists('\\Imagick')) {
140 try {
141 $imagick = new \Imagick();
142 $imagick->readImageBlob($res->getBody());
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 }
149 } else {
150 imagegif($im, $localPath);
151 }
152
139 $this->logger->debug('DownloadImages: Re-creating gif'); 153 $this->logger->debug('DownloadImages: Re-creating gif');
140 break; 154 break;
141 case 'jpeg': 155 case 'jpeg':