diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/DownloadImages.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/DownloadImages.php b/src/Wallabag/CoreBundle/Helper/DownloadImages.php index cc3dcfce..bc2afc64 100644 --- a/src/Wallabag/CoreBundle/Helper/DownloadImages.php +++ b/src/Wallabag/CoreBundle/Helper/DownloadImages.php | |||
@@ -135,7 +135,16 @@ 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 | $imagick = new \Imagick(); | ||
141 | $imagick->readImageBlob($res->getBody()); | ||
142 | $imagick->setImageFormat('gif'); | ||
143 | $imagick->writeImages($localPath, true); | ||
144 | } else { | ||
145 | imagegif($im, $localPath); | ||
146 | } | ||
147 | |||
139 | $this->logger->debug('DownloadImages: Re-creating gif'); | 148 | $this->logger->debug('DownloadImages: Re-creating gif'); |
140 | break; | 149 | break; |
141 | case 'jpeg': | 150 | case 'jpeg': |