Make thumbnail fix
This commit is contained in:
@@ -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
|
||||
{
|
||||
@@ -40,14 +41,16 @@ class Upload extends Controller
|
||||
$location = config('app.image.dir');
|
||||
|
||||
$backupdir = Carbon::now()->format('Y/m/d');
|
||||
$backupdir = sprintf($location.'/backup/%s',$backupdir);
|
||||
$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);
|
||||
$image = Image::make($backupdir."/".$bckfile)->resize(160, 120);
|
||||
\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.';
|
||||
|
||||
Reference in New Issue
Block a user