Merge branch 'AndreAle94-master'

pull/400/head
Varun Patil 2023-02-09 10:32:40 -08:00
commit e9f2fb91d4
1 changed files with 2 additions and 10 deletions

View File

@ -180,25 +180,17 @@ class Exif
*/
public static function getDateTaken(File &$file, array &$exif)
{
// Try to parse the date from exif metadata
$dt = $exif['DateTimeOriginal'] ?? null;
if (!isset($dt) || empty($dt)) {
$dt = $exif['CreateDate'] ?? null;
}
// Check if found something
try {
return self::parseExifDate($dt);
} catch (\Exception $ex) {
} catch (\ValueError $ex) {
}
// Fall back to creation time
$dateTaken = $file->getCreationTime();
// Fall back to modification time
if (0 === $dateTaken) {
$dateTaken = $file->getMtime();
}
return self::forgetTimezone($dateTaken);
}