I tried to resize img, I do this step: update composer:
"intervention/image": "dev-master",
next add lines in app/config
Intervention\Image\ImageServiceProvider::class,
'Image' => Intervention\Image\Facades\Image::class
In my controller:
use Intervention\Image\Image as Img;
Img::make($destination_path . $filename)->resize(200, 200)->save($destination_path . $filename);
and this is error:
Call to undefined method Intervention\Image\Image::make()
All In laravel 5.1
Just follow the below Steps:
1) Open composer.json file from your root directory
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"laravel/socialite": "^2.0",
// add these lines
"illuminate/html": "5.*",
"intervention/image": "dev-master"
}
2) Now run composer update command to get those packages.
composer update
3) Open config/app.php file
a) update the providers array with the following line.
'providers' => [
// add this line at the bottom
Intervention\Image\ImageServiceProvider::class
]
b) update the aliases array with the following line.
'aliases' => [
// add this line at the bottom
'Image' => Intervention\Image\Facades\Image::class
],
4) You are done!
See details here: http://www.pranms.com/intervention-image-integration-in-laravel/
Try:
1) check if you have model in your App (by default) folder named as Image
2)
a) put use Image;
to the top of your controller
b) throw this away: use Intervention\Image\Image as Img;
c) just use this: Image::make(
not Img:make(
I had the same problem myself. After a lot of googling, I found this tutorial specific for Laravel 5.1.
Simply change
use Intervention\Image\Image;
to
use Intervention\Image\Facades\Image;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With