Add gallery to app
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user