mirror of
https://github.com/friendica/friendica
synced 2024-11-18 17:03:41 +00:00
Merge pull request #11546 from nupplaphil/bug/catch_image_exception
Fix unsupported animated webp parsing
This commit is contained in:
commit
a1871756ee
1 changed files with 17 additions and 8 deletions
|
@ -159,6 +159,7 @@ class Image
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->valid = false;
|
$this->valid = false;
|
||||||
|
try {
|
||||||
$this->image = @imagecreatefromstring($data);
|
$this->image = @imagecreatefromstring($data);
|
||||||
if ($this->image !== false) {
|
if ($this->image !== false) {
|
||||||
$this->width = imagesx($this->image);
|
$this->width = imagesx($this->image);
|
||||||
|
@ -169,6 +170,14 @@ class Image
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} catch (\Throwable $error) {
|
||||||
|
/** @see https://github.com/php/doc-en/commit/d09a881a8e9059d11e756ee59d75bf404d6941ed */
|
||||||
|
if (strstr($error->getMessage(), "gd-webp cannot allocate temporary buffer")) {
|
||||||
|
DI::logger()->notice('Image is probably animated and therefore unsupported', ['error' => $error]);
|
||||||
|
} else {
|
||||||
|
DI::logger()->warning('Unexpected throwable.', ['error' => $error]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue