Files
meranie/routes/web.php
2021-09-27 09:02:38 +02:00

39 lines
1.3 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!
|
*/
Route::get('/', function () {
$dir = public_path().'/'.config('app.image.dir').'/backup/'.date('Y/m/d');
date_default_timezone_set('Europe/Bratislava');
$files = \File::allFiles($dir);
$items = [];
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[] = $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::any('upload/image',"Upload@uploadFile");