From cd1b47f7eaa89f6867024248c46374a8859ab821 Mon Sep 17 00:00:00 2001 From: Marttin Notta Date: Fri, 6 Jan 2023 10:58:50 +0200 Subject: [PATCH] Fix exif_imagetype handling --- CHANGELOG.md | 6 ++++++ src/Classes/MediaHandler.php | 2 ++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6f7cc9..b23dbe9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. --- +## [3.1.1] - 06-01-2023 + +### Fixed + +- `isReadableImage` now returns false when `exif_imagetype` returns false instead of throwing exception + ## [3.1.0] - 31-10-2022 ### Fixed diff --git a/src/Classes/MediaHandler.php b/src/Classes/MediaHandler.php index 2384d56..b669594 100644 --- a/src/Classes/MediaHandler.php +++ b/src/Classes/MediaHandler.php @@ -98,6 +98,8 @@ public function isReadableImage($file): bool try { $type = exif_imagetype($file); + if (!$type) return false; + // https://github.com/Intervention/image/pull/1008 return !in_array($type, [IMAGETYPE_ICO]); } catch (Exception $e) {