From bc4f7ec07926b4e27db012c5666aa5c8bc11d43c Mon Sep 17 00:00:00 2001 From: bierdok Date: Sun, 17 Mar 2019 22:45:23 +0000 Subject: [PATCH] Fix photo issue without complete exif datas --- src/Controller/DefaultController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Controller/DefaultController.php b/src/Controller/DefaultController.php index 2fb3ff1..9c6c7a2 100644 --- a/src/Controller/DefaultController.php +++ b/src/Controller/DefaultController.php @@ -32,7 +32,10 @@ public function index(Request $request) if (!$data = @exif_read_data($file->getRealPath())) { continue; } - $time = new \DateTime($data['DateTimeOriginal']); + $time = new \DateTime(sprintf('@%d', $data['FileDateTime'])); + if (isset($data['DateTimeOriginal'])) { + $time = new \DateTime($data['DateTimeOriginal']); + } $galleries[$time->format('Y-m')][$time->getTimestamp() . $x] = [ 'name' => $file->getFilename(), 'time' => $time->getTimestamp(),