mirror of
https://github.com/wallabag/wallabag.git
synced 2025-03-30 06:45:29 +00:00
Fallback to default solution if Imagick fails
This commit is contained in:
parent
77bd7f690d
commit
844fd9fafc
1 changed files with 9 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue