diff options
author | Mario <mario@mariovavti.com> | 2024-03-01 16:01:53 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-03-01 16:01:53 +0000 |
commit | b73401bd7fb4ebe9f3abad627c6b8e2d497b6089 (patch) | |
tree | b08b2acd7e7ed3f2fe607980834775ff846f9d5d /include/photo | |
parent | af839a05892f9446e86327ba04787b3a697c379c (diff) | |
download | volse-hubzilla-b73401bd7fb4ebe9f3abad627c6b8e2d497b6089.tar.gz volse-hubzilla-b73401bd7fb4ebe9f3abad627c6b8e2d497b6089.tar.bz2 volse-hubzilla-b73401bd7fb4ebe9f3abad627c6b8e2d497b6089.zip |
handle imagick readImageBlob() exception
Diffstat (limited to 'include/photo')
-rw-r--r-- | include/photo/photo_driver.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 522e638de..4394d3238 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -117,7 +117,14 @@ function guess_image_type($filename, $data = '') { $body = $data['body']; if ($body) { $image = new Imagick(); - $image->readImageBlob($body); + + try{ + $image->readImageBlob($body); + } catch (\Exception $e) { + logger('Imagick readImageBlob() exception:' . print_r($e, true)); + return $type; + } + $r = $image->identifyImage(); if ($r && is_array($r) && array_key_exists($r['mimetype'], $types)) $type = $r['mimetype']; |