Merge pull request #9342 from annando/fatal

Avoids fatal error: Uncaught ImagickException: cache resources exhausted
This commit is contained in:
Tobias Diekershoff 2020-10-03 09:59:07 +02:00 committed by GitHub
commit 8623c075af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,7 +22,6 @@
namespace Friendica\Object; namespace Friendica\Object;
use Exception; use Exception;
use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
use Friendica\Util\Images; use Friendica\Util\Images;
use Imagick; use Imagick;
@ -123,7 +122,11 @@ class Image
$this->image->setFormat($format); $this->image->setFormat($format);
// Always coalesce, if it is not a multi-frame image it won't hurt anyway // Always coalesce, if it is not a multi-frame image it won't hurt anyway
$this->image = $this->image->coalesceImages(); try {
$this->image = $this->image->coalesceImages();
} catch (Exception $e) {
return false;
}
/* /*
* setup the compression here, so we'll do it only once * setup the compression here, so we'll do it only once