Make thumbnail fix

This commit is contained in:
root
2021-09-21 21:06:36 +02:00
parent 6ea0c96557
commit 493c10eb45
2 changed files with 7 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Carbon\Carbon;
use Intervention\Image\ImageManagerStatic as Image;
class Upload extends Controller
{
@@ -41,13 +42,15 @@ class Upload extends Controller
$backupdir = Carbon::now()->format('Y/m/d');
$backupdir = sprintf($location.'/backup/%s',$backupdir);
$thumbdir = sprintf('%s/%s', config('app.image.thumb_dir'), Carbon::now()->format('Y/m/d'));
$bckfile = Carbon::now()->format('Hi');
$bckfile = sprintf('%s.jpg',$bckfile);
// Upload file
$file->move($backupdir,$bckfile);
\File::copy($backupdir."/".$bckfile,$location."/".$filename);
$image = Image::make($backupdir."/".$bckfile)->resize(160, 120);
$image->save( config('app.image.thumb_dir').'/'.$bckfile);
\File::makeDirectory($thumbdir, $mode = 0770, true, true);
$image->save( $thumbdir.'/'.$bckfile);
echo 'Upload Successful.';
}else{
echo 'File too large. File must be less than 2MB.';

View File

@@ -184,17 +184,6 @@
</b-tabs>
</b-card>
<div v-if="host == 'strecha'">
<b-tabs card>
<b-tab title="Dnes">
<vue-gallery-slideshow :images="images-0" :index="index" @close="index = null"></vue-gallery-slideshow>
</b-tab>
<b-tab title="Včera">
<vue-gallery-slideshow :images="images-1" :index="index" @close="index = null"></vue-gallery-slideshow>
</b-tab>
<b-tab title="Predvčerom">
<vue-gallery-slideshow :images="images-2" :index="index" @close="index = null"></vue-gallery-slideshow>
</b-tab>
<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="" />
</b-tabs>