mirror of
https://github.com/wallabag/wallabag.git
synced 2025-02-06 02:33:48 +01:00
Fallback to default solution if Imagick fails
This commit is contained in:
parent
77bd7f690d
commit
844fd9fafc
@ -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…
x
Reference in New Issue
Block a user