I’m new to Laravel, I use Intervention Image on laravel 10.39.0, but it is getting error,
Class "InterventionImageFacadesImage" not found
This is the code.
This is the code.
<?php
namespace AppHttpControllers;
use IlluminateHttpRequest;
use InterventionImageFacadesImage;
class HomeController extends Controller
{
public function index(){
return view('home');
}
public function test(){
// Open an image file
$img = Image::make('uploads/img1.jpg');
$img->crop(300,300);
$img->save(public_path('uploads/corp_img1.jpg'));
}
}
error is showing on this line: $img = Image::make(‘uploads/img1.jpg’);
"intervention/image": "^3.2",
PHP: PHP 8.2.10-2ubuntu1
How to solve this issue?
2
Answers
After a couple of hours, I found the answer, this code might be helpful to others.
First check the
intervention/image
is installed correctly you can check first this directoryvendor/intervention/image
orcomposer show intervention/image
.if you can see this directory try this commands
composer dump-autoload
.then you can try to clear cache
php artisan cache:clear
after that try again and check is problem exists.