mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-15 18:57:05 +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':
|
case 'gif':
|
||||||
// use Imagick if available to keep GIF animation
|
// use Imagick if available to keep GIF animation
|
||||||
if (class_exists('\\Imagick')) {
|
if (class_exists('\\Imagick')) {
|
||||||
$imagick = new \Imagick();
|
try {
|
||||||
$imagick->readImageBlob($res->getBody());
|
$imagick = new \Imagick();
|
||||||
$imagick->setImageFormat('gif');
|
$imagick->readImageBlob($res->getBody());
|
||||||
$imagick->writeImages($localPath, true);
|
$imagick->setImageFormat('gif');
|
||||||
|
$imagick->writeImages($localPath, true);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// if Imagick fail, fallback to the default solution
|
||||||
|
imagegif($im, $localPath);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
imagegif($im, $localPath);
|
imagegif($im, $localPath);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue