Laravel 5 image resize

I use Laravel 5 and have a form to upload a image. When saving the file I have in my controller methods to get the image and put it in a directory:

if ($request->hasFile('picture')) {
    $destinationPath = 'uploads';
    $filename = $image->getClientOriginalName();
    $extension = $image->getClientOriginalExtension(); // add
    $picture = sha1($filename . time()) . '.' . $extension; //add
    $offer->image = $picture;
    $image->move($destinationPath, $picture);
}
$offer->save();

Before I save the file I would like to resize the file with a max. width of 800px. Is there a image resize or compression function in Laravel available? What would be the best idea to do this?


ANSWERS:


You can install and use package, similar to intervention.

Example from official website:

$img = Image::make('public/foo.jpg');
$img->resize(320, 240);
$img->insert('public/watermark.png');
$img->save('public/bar.jpg');

Image::make($request->file('image'))->resize(462, 462)->save('upload_path/filename.jpg'));

try this code



 MORE:


 ? TinyMCE Image Upload with Laravel, without File Manager
 ? Laravel file manager illegal offset type
 ? Laravel file manager illegal offset type
 ? Laravel file manager illegal offset type
 ? Laravel 5 helper function asset different domains
 ? Change .htaccess file in laravel 4
 ? Implementing TinyMCE and JQuery in laravel 4.1?
 ? Laravel routing not working on MAMP
 ? Call methods inside public folder - Laravel
 ? Insert text into repeated tinyMCE elements