Call to undefined method Intervention\Image\Facades\Image::make()

DMS-KH picture DMS-KH · Nov 1, 2016 · Viewed 13.8k times · Source

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()

Answer

Seunope picture Seunope · Jun 9, 2017

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;