aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2019-05-10 21:24:06 +0300
committerGitHub <noreply@github.com>2019-05-10 21:24:06 +0300
commitde1162b91a205a98a3f8ed01bd80285793b18380 (patch)
tree00bbdab87df426a541df33af15b6c4aa78b4b436 /src/Wallabag
parent6e67f41152ad025e74696e7140de0f9fb0d601de (diff)
parent844fd9fafc577faa8d6c8faa4e37b915be2389d9 (diff)
downloadwallabag-de1162b91a205a98a3f8ed01bd80285793b18380.tar.gz
wallabag-de1162b91a205a98a3f8ed01bd80285793b18380.tar.zst
wallabag-de1162b91a205a98a3f8ed01bd80285793b18380.zip
Merge pull request #3955 from wallabag/fix/gif-animation-imagick
Use Imagick to keep GIF animation
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':