问题
I upgrade from Laravel4.2 to Laravel5.3 with intervention/image : "^2.3",
if (Input::hasFile('logo')) {
$path = public_path()."/assets/admin/layout/img/";
File::makeDirectory($path, $mode = 0777, true, true);
$image = Input::file('logo');
$extension = $image->getClientOriginalExtension();
$filename = "logo.$extension";
$filename_big = "logo-big.$extension";
Image::make($image->getRealPath())->save($path.$filename);
Image::make($image->getRealPath())->save($path.$filename_big);
$data['logo'] = $filename;
}
The result I got error
Call to undefined method Intervention\Image\Facades\Image::make()
回答1:
I experienced the same issue in my Laravel 5.4 project. I stumble on this link
that help resolve the issue. This was the fix that was provided
In config/app change 'aliases' for Image from
'Image' => Intervention\Image\Facades\Image::class,
To
'Image' => Intervention\Image\ImageManagerStatic::class,
Then in your controller header add
use Image;
回答2:
Make Sure that In config/app update Providers with
Intervention\Image\ImageServiceProvider::class
and update aliases with
'Image' => Intervention\Image\Facades\Image::class,
来源:https://stackoverflow.com/questions/40353307/call-to-undefined-method-intervention-image-facades-imagemake