Skip to content

Commit 4b2ad82

Browse files
author
Younès El Biache
committed
handle getimagesizefromstring errors
1 parent ca49bdf commit 4b2ad82

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/ImageInfo/UtilsTrait.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ protected static function getEmbeddedImageInfo($content)
1919
return false;
2020
}
2121

22-
$info = getimagesizefromstring(base64_decode(substr($pieces[1], 7)));
22+
if (($info = @getimagesizefromstring(base64_decode(substr($pieces[1], 7)))) !== false) {
23+
return [
24+
'width' => $info[0],
25+
'height' => $info[1],
26+
'size' => $info[0] * $info[1],
27+
'mime' => $info['mime'],
28+
];
29+
}
2330

24-
return [
25-
'width' => $info[0],
26-
'height' => $info[1],
27-
'size' => $info[0] * $info[1],
28-
'mime' => $info['mime'],
29-
];
31+
return false;
3032
}
31-
}
33+
}

0 commit comments

Comments
 (0)