Merge branch 'AndreAle94-master'
commit
e9f2fb91d4
12
lib/Exif.php
12
lib/Exif.php
|
@ -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();
|
||||
}
|
||||
$dateTaken = $file->getMtime();
|
||||
|
||||
return self::forgetTimezone($dateTaken);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue