Skip to content

Commit

Permalink
Handle failed image size check gracefully and return default values
Browse files Browse the repository at this point in the history
  • Loading branch information
Baspa committed Nov 26, 2024
1 parent 35c90ca commit 439fbb0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Checks/Content/AltTagCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,14 @@ private function getImageDimensions(string $src, Crawler $node): array
];
}

$dimensions = getimagesize($src);
$dimensions = @getimagesize($src);

if ($dimensions === false) {
return [
'width' => 0,
'height' => 0,
];
}

return [
'width' => $dimensions[0],
Expand Down

0 comments on commit 439fbb0

Please sign in to comment.