Skip to content

Commit 0d961b1

Browse files
authored
[5.4] Preventing notices for broken images (joomla#46435)
1 parent c0d986c commit 0d961b1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

libraries/src/Helper/MediaHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ public static function getMimeType($file, $isImage = false)
8989
$mime = false;
9090

9191
try {
92-
if ($isImage && \function_exists('exif_imagetype')) {
92+
if ($isImage && \function_exists('exif_imagetype') && filesize($file) > 12) {
9393
$mime = image_type_to_mime_type(exif_imagetype($file));
94-
} elseif ($isImage && \function_exists('getimagesize')) {
94+
} elseif ($isImage && \function_exists('getimagesize') && filesize($file) > 12) {
9595
$imagesize = getimagesize($file);
9696
$mime = $imagesize['mime'] ?? false;
9797
} elseif (\function_exists('mime_content_type')) {

libraries/src/Image/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public static function getImageFileProperties($path)
174174
}
175175

176176
// Get the image file information.
177-
$info = getimagesize($path);
177+
$info = @getimagesize($path);
178178

179179
if (!$info) {
180180
throw new Exception\UnparsableImageException('Unable to get properties for the image.');

0 commit comments

Comments
 (0)