Fallback to default solution if Imagick fails
This commit is contained in:
parent
77bd7f690d
commit
844fd9fafc
@ -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…
x
Reference in New Issue
Block a user