50 lines
1.6 KiB
PHP
50 lines
1.6 KiB
PHP
<?php
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Web Routes
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Here is where you can register web routes for your application. These
|
|
| routes are loaded by the RouteServiceProvider within a group which
|
|
| contains the "web" middleware group. Now create something great!
|
|
|
|
|
*/
|
|
|
|
Use Carbon\Carbon;
|
|
|
|
Route::get('/', function () {
|
|
date_default_timezone_set(config('app.timezone'));
|
|
$items = [];
|
|
|
|
for ($i=0; $i>=-2 ; $i-- ) {
|
|
$dt = Carbon::now()->add($i,'day');
|
|
$dir = public_path().'/'.config('app.image.dir').'/backup/'.$dt->format('Y/m/d');
|
|
|
|
if (! \File::isDirectory($dir)) {
|
|
continue;
|
|
}
|
|
|
|
$files = \File::allFiles($dir);
|
|
$items[$i] = [];
|
|
foreach ($files as $file) {
|
|
$pstat = stat($file);
|
|
$time = date('d.m.Y 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[$i][] = $item;
|
|
}
|
|
}
|
|
return view('welcome')->with('items',$items);
|
|
});
|
|
|
|
Route::get('/data',"MeasurementController@index");
|
|
Route::get('/data/get',"MeasurementController@get");
|
|
Route::get('/stats/get',"StatisticsController@get");
|
|
Route::get('/images/get',"ImagesController@get");
|
|
Route::any('upload/image',"Upload@uploadFile");
|
|
|