Skip to content

Commit

Permalink
fix: handle exif metadata read errors gracefully
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
  • Loading branch information
st3iny committed Jan 15, 2024
1 parent af00330 commit 8f0ab22
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/private/Metadata/Provider/ExifProvider.php
Expand Up @@ -67,8 +67,8 @@ public function execute(File $file): array {
$size->setId($file->getId());
$size->setArrayAsValue([]);

if (!$data) {
$sizeResult = getimagesizefromstring($file->getContent());
if (!$data && ($content = $file->getContent())) {
$sizeResult = getimagesizefromstring($content);
if ($sizeResult !== false) {
$size->setArrayAsValue([
'width' => $sizeResult[0],
Expand All @@ -77,7 +77,7 @@ public function execute(File $file): array {

$exifData['size'] = $size;
}
} elseif (array_key_exists('COMPUTED', $data)) {
} elseif ($data && array_key_exists('COMPUTED', $data)) {
if (array_key_exists('Width', $data['COMPUTED']) && array_key_exists('Height', $data['COMPUTED'])) {
$size->setArrayAsValue([
'width' => $data['COMPUTED']['Width'],
Expand Down

0 comments on commit 8f0ab22

Please sign in to comment.