Fallback to upload time first
parent
56fee51f1c
commit
b8e5901aaf
|
@ -14,7 +14,7 @@ class Util {
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDateTaken($file) {
|
public static function getDateTaken(File $file) {
|
||||||
// Attempt to read exif data
|
// Attempt to read exif data
|
||||||
if (in_array($file->getMimeType(), Application::IMAGE_MIMES)) {
|
if (in_array($file->getMimeType(), Application::IMAGE_MIMES)) {
|
||||||
$exif = exif_read_data($file->fopen('rb'));
|
$exif = exif_read_data($file->fopen('rb'));
|
||||||
|
@ -30,6 +30,11 @@ class Util {
|
||||||
// Fall back to creation time
|
// Fall back to creation time
|
||||||
$dateTaken = $file->getCreationTime();
|
$dateTaken = $file->getCreationTime();
|
||||||
|
|
||||||
|
// Fall back to upload time
|
||||||
|
if ($dateTaken == 0) {
|
||||||
|
$dateTaken = $file->getUploadTime();
|
||||||
|
}
|
||||||
|
|
||||||
// Fall back to modification time
|
// Fall back to modification time
|
||||||
if ($dateTaken == 0) {
|
if ($dateTaken == 0) {
|
||||||
$dateTaken = $file->getMtime();
|
$dateTaken = $file->getMtime();
|
||||||
|
|
Loading…
Reference in New Issue