From aeafd50b328823e40d464003fc5fbe4606bbcd2d Mon Sep 17 00:00:00 2001 From: Arne Hamann Date: Wed, 23 Mar 2022 16:59:12 +0100 Subject: [PATCH] Include addtional information to nonlocalized photos Signed-off-by: Arne Hamann --- lib/Service/GeophotoService.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/Service/GeophotoService.php b/lib/Service/GeophotoService.php index 8a78e53ec..50732b4bf 100644 --- a/lib/Service/GeophotoService.php +++ b/lib/Service/GeophotoService.php @@ -131,10 +131,11 @@ public function getNonLocalizedFromDB ($userId) { continue; } $file = array_shift($files); - if ($file === null) { - continue; - } - $path = preg_replace('/^\/'.$userId.'\//', '', $file->getPath()); + if ($file === null) { + continue; + } + $path = $userFolder->getRelativePath( $file->getPath()); + $isRoot = $file === $userFolder; $date = $photoEntity->getDateTaken() ?? \time(); $locations = $this->getLocationGuesses($date); @@ -146,6 +147,17 @@ public function getNonLocalizedFromDB ($userId) { $file_object->lat = $location[0]; $file_object->lng = $location[1]; $file_object->dateTaken = $date; + $file_object->basename = $isRoot ? '' : $file->getName(); + $file_object->filename = $this->normalizePath($path); + $file_object->etag = $cacheEntry->getEtag(); +//Not working for NC21 as Viewer requires String representation of permissions +// $file_object->permissions = $file->getPermissions(); + $file_object->type = $file->getType(); + $file_object->mime = $file->getMimetype(); + $file_object->lastmod = $file->getMTime(); + $file_object->size = $file->getSize(); + $file_object->path = $path; + $file_object->hasPreview = in_array($cacheEntry->getMimeType(), $previewEnableMimetypes); $filesById[] = $file_object; }