Add gallery to app

This commit is contained in:
2021-09-26 21:05:48 +02:00
parent 2f61e1342e
commit c2480ea73c
13 changed files with 152134 additions and 28 deletions

View File

@@ -12,7 +12,22 @@
*/
Route::get('/', function () {
return view('welcome');
$dir = public_path().'/'.config('app.image.dir').'/backup/'.date('Y/m/d');
$files = \File::allFiles($dir);
$items = [];
foreach ($files as $file) {
$pstat = stat($file);
$time = date('Y M D H:i:s',$pstat['mtime']);
$thumb_file = str_replace('backup','thumb',$file);
$item = ['src' => str_replace($_SERVER['DOCUMENT_ROOT'], '', $file),
'thumbnail' => str_replace($_SERVER['DOCUMENT_ROOT'], '', $thumb_file),
'w' => 1600, 'h' => 1200, 'title' => 'Time of photo: '. $time];
$items[] = $item;
}
return view('welcome')->with('items',$items);
});
Route::get('/data',"MeasurementController@index");