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 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="" />
|
||||
<div class="h4 mt-3 bg-info">Galeria za aktualny deň</div>
|
||||
<vue-picture-swipe :items="{{ json_encode($items) }}"></vue-picture-swipe>
|
||||
</b-tabs>
|
||||
<div class="h4 mt-3 bg-info">Galeria</div>
|
||||
@if (count($items) > 0)
|
||||
<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>
|
||||
|
||||
|
||||
@@ -11,28 +11,39 @@
|
||||
|
|
||||
*/
|
||||
|
||||
Use Carbon\Carbon;
|
||||
|
||||
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);
|
||||
date_default_timezone_set(config('app.timezone'));
|
||||
$items = [];
|
||||
foreach ($files as $file) {
|
||||
$pstat = stat($file);
|
||||
$time = date('d.m.Y H:i:s',$pstat['mtime']);
|
||||
|
||||
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');
|
||||
|
||||
$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;
|
||||
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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user