The problem may be due to these reasons.
Have you added these aliases to your app.php
'aliases' => [
//add these three at the bottom
'Form' => Illuminate\Html\FormFacade::class,
'HTML' => Illuminate\Html\HtmlFacade::class,
'Image' => Intervention\Image\Facades\Image::class
],
I believe that you already have a form and an html helper.
And use this function in the controller
ie, just pass the image value and size as a parameter to this function
In the controller, you simply call the function below, for example
$resizedImage = $this->resize($image, $request->get('image_size'));
resize()
private function resize($image, $size)
{
try
{
$extension = $image->getClientOriginalExtension();
$imageRealPath = $image->getRealPath();
$thumbName = 'thumb_'. $image->getClientOriginalName();
$img = Image::make($imageRealPath);
$img->resize(intval($size), null, function($constraint) {
$constraint->aspectRatio();
});
return $img->save(public_path('images'). '/'. $thumbName);
}
catch(Exception $e)
{
return false;
}