Skip to content

Commit 49bb2d3

Browse files
authored
No exception when no EXIF data is found
Instead of throwing a \RuntimeException, return false when no data is found
1 parent f411c27 commit 49bb2d3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/PHPExif/Adapter/Native.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ public function getSectionsAsArrays()
170170
* Reads & parses the EXIF data from given file
171171
*
172172
* @param string $file
173-
* @return \PHPExif\Exif Instance of Exif object with data
174-
* @throws \RuntimeException If the EXIF data could not be read
173+
* @return \PHPExif\Exif|boolean Instance of Exif object with data
175174
*/
176175
public function getExifFromFile($file)
177176
{
@@ -187,9 +186,7 @@ public function getExifFromFile($file)
187186
);
188187

189188
if (false === $data) {
190-
throw new \RuntimeException(
191-
sprintf('Could not read EXIF data from file %1$s', $file)
192-
);
189+
return false;
193190
}
194191

195192
$xmpData = $this->getIptcData($file);

0 commit comments

Comments
 (0)