Upload dir, Upload contoller, view images
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
||||
/node_modules
|
||||
/public/hot
|
||||
/public/storage
|
||||
/public/upload/*
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
|
||||
@@ -9,49 +9,49 @@ class Upload extends Controller
|
||||
public function index(){
|
||||
return view('index');
|
||||
}
|
||||
|
||||
|
||||
public function uploadFile(Request $request){
|
||||
|
||||
|
||||
if ($request->input('submit') != null ){
|
||||
|
||||
|
||||
$file = $request->file('file');
|
||||
|
||||
|
||||
// File Details
|
||||
$filename = $file->getClientOriginalName();
|
||||
$extension = $file->getClientOriginalExtension();
|
||||
$tempPath = $file->getRealPath();
|
||||
$fileSize = $file->getSize();
|
||||
$mimeType = $file->getMimeType();
|
||||
|
||||
|
||||
// Valid File Extensions
|
||||
$valid_extension = array("jpg","jpeg","png");
|
||||
|
||||
|
||||
// 2MB in Bytes
|
||||
$maxFileSize = 2097152;
|
||||
|
||||
|
||||
// Check file extension
|
||||
if(in_array(strtolower($extension),$valid_extension)){
|
||||
|
||||
|
||||
// Check file size
|
||||
if($fileSize <= $maxFileSize){
|
||||
|
||||
|
||||
// File upload location
|
||||
$location = 'images';
|
||||
|
||||
$location = 'upload/images';
|
||||
|
||||
// Upload file
|
||||
$file->move($location,$filename);
|
||||
|
||||
Session::flash('message','Upload Successful.');
|
||||
|
||||
echo 'Upload Successful.';
|
||||
}else{
|
||||
Session::flash('message','File too large. File must be less than 2MB.');
|
||||
echo 'File too large. File must be less than 2MB.';
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
Session::flash('message','Invalid File Extension.');
|
||||
echo 'message Invalid File Extension.';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Redirect to index
|
||||
echo "OK";
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<script src="{{ asset('js/app.js') }}" defer></script>
|
||||
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
<div class="title m-b-md">
|
||||
Teplomer balkón
|
||||
</div>
|
||||
|
||||
|
||||
<div id="app">
|
||||
<div class="row">
|
||||
<vue-thermometer class="justify-content-center col-sm-3" :value="temperature" :min="tmin" :max="tmax"></vue-thermometer>
|
||||
@@ -105,13 +105,13 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="form-group col-sm-6">
|
||||
<div class='input-group time' id='datetimepicker1'>
|
||||
<datetime type="datetime" input-class="form-control" placeholder="Od" v-model="startdate"></datetime>
|
||||
<datetime type="datetime" input-class="form-control" placeholder="Od" v-model="startdate"></datetime>
|
||||
<span class="input-group-append">
|
||||
<span class="input-group-text"><i class="fa fa-calendar"></i></span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
<div class='input-group time' id='datetimepicker2'>
|
||||
<datetime type="datetime" input-class="form-control" placeholder="Do" v-model="enddate"></datetime>
|
||||
@@ -120,7 +120,7 @@
|
||||
</span>
|
||||
<span class="input-group-append">
|
||||
<button v-on:click="displayResults()" type="button" class="btn btn-secondary">Zobraz</button>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -128,7 +128,7 @@
|
||||
</div>
|
||||
<b-card no-body>
|
||||
<b-tabs v-model="ti" card lazy>
|
||||
<b-tab title="Teplota" @click="resizeGraph(0)">
|
||||
<b-tab title="Teplota" @click="resizeGraph(0)">
|
||||
<dygraphs ref="dg[0]" :graph-data="series['temperature']" :graph-options="options['temperature']"></dygraphs>
|
||||
<br/>
|
||||
<!-- Tabs with card integration -->
|
||||
@@ -139,10 +139,10 @@
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'temperature'" :key="componentKey"></stats-table>
|
||||
</b-tab>
|
||||
<b-tab title="Hodina">
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'temperature'" :range="'1h'" :key="componentKey"></stats-table>
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'temperature'" :range="'1h'" :key="componentKey"></stats-table>
|
||||
</b-tab>
|
||||
<b-tab title="Deň" v-if="startdate">
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'temperature'" :range="'1d'" :key="componentKey"></stats-table>
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'temperature'" :range="'1d'" :key="componentKey"></stats-table>
|
||||
</b-tab>
|
||||
</b-tabs>
|
||||
</b-card>
|
||||
@@ -156,10 +156,10 @@
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'humidity'" :key="componentKey"></stats-table>
|
||||
</b-tab>
|
||||
<b-tab title="Hodina">
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'humidity'" :range="'1h'" :key="componentKey"></stats-table>
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'humidity'" :range="'1h'" :key="componentKey"></stats-table>
|
||||
</b-tab>
|
||||
<b-tab title="Deň" v-if="startdate">
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'humidity'" :range="'1d'" :key="componentKey"></stats-table>
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'humidity'" :range="'1d'" :key="componentKey"></stats-table>
|
||||
</b-tab>
|
||||
</b-tabs>
|
||||
</b-card>
|
||||
@@ -173,23 +173,26 @@
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'pressure'" :key="componentKey"></stats-table>
|
||||
</b-tab>
|
||||
<b-tab title="Hodina">
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'pressure'" :range="'1h'" :key="componentKey"></stats-table>
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'pressure'" :range="'1h'" :key="componentKey"></stats-table>
|
||||
</b-tab>
|
||||
<b-tab title="Deň" v-if="startdate">
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'pressure'" :range="'1d'" :key="componentKey"></stats-table>
|
||||
<stats-table :fromdate="startdate" :todate="enddate" :type="'pressure'" :range="'1d'" :key="componentKey"></stats-table>
|
||||
</b-tab>
|
||||
</b-tabs>
|
||||
</b-card>
|
||||
</b-tab>
|
||||
</b-tabs>
|
||||
</b-card>
|
||||
</div>
|
||||
|
||||
<div v-if="host == 'strecha'">
|
||||
<img src="{{ url('upload/images/camera.jpg') }}" alt="" title="" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user