Skip to content

Commit 05e6ec6

Browse files
committed
Adding dateTaken and dateUploaded to the upload api.
1 parent 00a9a31 commit 05e6ec6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/libraries/models/Photo.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,15 @@ public static function upload($localFile, $name, $attributes = array())
416416
$attributes[$default] = null;
417417
}
418418

419-
$dateUploaded = time();
420-
$dateTaken = @$exif['dateTaken'];
419+
if(isset($attributes['dateUploaded']) && !empty($attributes['dateUploaded']))
420+
$dateUploaded = $attributes['dateUploaded'];
421+
else
422+
$dateUploaded = time();
423+
424+
if(isset($attributes['dateTaken']) && !empty($attributes['dateTaken']))
425+
$dateTaken = $attributes['dateTaken'];
426+
else
427+
$dateTaken = @$exif['dateTaken'];
421428

422429
if(getConfig()->get('photos')->autoTagWithDate == 1)
423430
{
@@ -614,7 +621,8 @@ private static function whitelistParams($attributes)
614621
{
615622
$returnAttrs = array();
616623
$matches = array('id' => 1,'host' => 1,'appId' => 1,'title' => 1,'description' => 1,'key' => 1,'hash' => 1,'tags' => 1,'size' => 1,'width' => 1,'photo'=>1,
617-
'height' => 1,'altitude' => 1, 'latitude' => 1,'longitude' => 1,'views' => 1,'status' => 1,'permission' => 1,'groups' => 1,'license' => 1);
624+
'height' => 1,'altitude' => 1, 'latitude' => 1,'longitude' => 1,'views' => 1,'status' => 1,'permission' => 1,'groups' => 1,'license' => 1,
625+
'dateTaken' => 1, 'dateUploaded' => 1);
618626
$patterns = array('exif.*' => 1,'date.*' => 1,'path.*' => 1);
619627
foreach($attributes as $key => $val)
620628
{

0 commit comments

Comments
 (0)