Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I upgraded from Laravel 4.2 to Laraveld5.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 Is, got the error below:

Call to undefined method Intervention\Image\Facades\Image::make()
like image 480
DMS-KH Avatar asked Nov 01 '16 02:11

DMS-KH


2 Answers

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;
like image 88
Seunope Avatar answered Nov 20 '22 19:11

Seunope


Make Sure that In config/app update Providers with

Intervention\Image\ImageServiceProvider::class

and update aliases with

'Image' => Intervention\Image\Facades\Image::class,
like image 2
Taufiqur Rahman Avatar answered Nov 20 '22 18:11

Taufiqur Rahman