I'm new to Laravel, I use Intervention Image on laravel 10.39.0, but it is getting error, Class "Intervention\Image\Facades\Image" not found
This is the code.
This is the code.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Intervention\Image\Facades\Image;
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?
First check the
intervention/imageis installed correctly you can check first this directoryvendor/intervention/imageorcomposer 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:clearafter that try again and check is problem exists.