Skip to content

Commit

Permalink
do not fail if size metadata for an image fail
Browse files Browse the repository at this point in the history
some images may trigger an exception when trying to get their size

Signed-off-by: Matthieu Gallien <[email protected]
  • Loading branch information
mgallien committed May 1, 2023
1 parent 193e096 commit 8dd1da6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/private/Metadata/Provider/ExifProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ public function execute(File $file): array {
$size->setArrayAsValue([]);

if (!$data) {
$sizeResult = getimagesizefromstring($file->getContent());
try {
$sizeResult = getimagesizefromstring($file->getContent());
} catch (\Exception $ex) {
$this->logger->info("Couldn't extract metadata for ".$file->getId(), ['exception' => $ex]);
$sizeResult = false;
}
if ($sizeResult !== false) {
$size->setArrayAsValue([
'width' => $sizeResult[0],
Expand Down

0 comments on commit 8dd1da6

Please sign in to comment.