Add yesterday images to gallery
This commit is contained in:
@@ -67,7 +67,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'timezone' => 'UTC',
|
'timezone' => 'Europe/Bratislava',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -186,9 +186,26 @@
|
|||||||
<div v-if="host == 'strecha'">
|
<div v-if="host == 'strecha'">
|
||||||
<div class="h4 mt-3 bg-info">Aktuálny obrázok z kamery</div>
|
<div class="h4 mt-3 bg-info">Aktuálny obrázok z kamery</div>
|
||||||
<img class="img-fluid" src="{{ url('upload/images/camera.jpg') }}" alt="" title="" />
|
<img class="img-fluid" src="{{ url('upload/images/camera.jpg') }}" alt="" title="" />
|
||||||
<div class="h4 mt-3 bg-info">Galeria za aktualny deň</div>
|
<div class="h4 mt-3 bg-info">Galeria</div>
|
||||||
<vue-picture-swipe :items="{{ json_encode($items) }}"></vue-picture-swipe>
|
@if (count($items) > 0)
|
||||||
</b-tabs>
|
<b-tabs card lazy>
|
||||||
|
@if (count($items[0]) > 0)
|
||||||
|
<b-tab title="Dnešok">
|
||||||
|
<vue-picture-swipe :items="{{ json_encode($items[0]) }}"></vue-picture-swipe>
|
||||||
|
</b-tab>
|
||||||
|
@endif
|
||||||
|
@if (isset($items[-1]) && count($items[-1]) > 0)
|
||||||
|
<b-tab title="Včerajšok">
|
||||||
|
<vue-picture-swipe :items="{{ json_encode($items[-1]) }}"></vue-picture-swipe>
|
||||||
|
</b-tab>
|
||||||
|
@endif
|
||||||
|
@if (isset($items[-2]) && count($items[-2]) > 0)
|
||||||
|
<b-tab title="Predvčerajšok">
|
||||||
|
<vue-picture-swipe :items="{{ json_encode($items[-2]) }}"></vue-picture-swipe>
|
||||||
|
</b-tab>
|
||||||
|
@endif
|
||||||
|
</b-tabs>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -11,28 +11,39 @@
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Use Carbon\Carbon;
|
||||||
|
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
$dir = public_path().'/'.config('app.image.dir').'/backup/'.date('Y/m/d');
|
date_default_timezone_set(config('app.timezone'));
|
||||||
|
|
||||||
date_default_timezone_set('Europe/Bratislava');
|
|
||||||
$files = \File::allFiles($dir);
|
|
||||||
$items = [];
|
$items = [];
|
||||||
foreach ($files as $file) {
|
|
||||||
$pstat = stat($file);
|
for ($i=0; $i>=-2 ; $i-- ) {
|
||||||
$time = date('d.m.Y H:i:s',$pstat['mtime']);
|
$dt = Carbon::now()->add($i,'day');
|
||||||
|
$dir = public_path().'/'.config('app.image.dir').'/backup/'.$dt->format('Y/m/d');
|
||||||
|
|
||||||
$thumb_file = str_replace('backup','thumb',$file);
|
if (! \File::isDirectory($dir)) {
|
||||||
$item = ['src' => str_replace($_SERVER['DOCUMENT_ROOT'], '', $file),
|
continue;
|
||||||
'thumbnail' => str_replace($_SERVER['DOCUMENT_ROOT'], '', $thumb_file),
|
|
||||||
'w' => 1600, 'h' => 1200, 'title' => 'Time of photo: '. $time];
|
|
||||||
$items[] = $item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$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);
|
return view('welcome')->with('items',$items);
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/data',"MeasurementController@index");
|
Route::get('/data',"MeasurementController@index");
|
||||||
Route::get('/data/get',"MeasurementController@get");
|
Route::get('/data/get',"MeasurementController@get");
|
||||||
Route::get('/stats/get',"StatisticsController@get");
|
Route::get('/stats/get',"StatisticsController@get");
|
||||||
|
Route::get('/images/get',"ImagesController@get");
|
||||||
Route::any('upload/image',"Upload@uploadFile");
|
Route::any('upload/image',"Upload@uploadFile");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user