So I am following a course from Udemy by Brad about Laravel, and while it is from almost two years ago now, many people recommended it to me because everything is still relevant. In one of his lessons, he uses this composer code called Intervention, which allows you to resize an image a user has/is submitting to your DB.
Now in the controller, he uses the class use InterventionImageFacadesImage;
and on his screen it works, but when I use the same class, laravel spits out this code error Class "InterventionImageFacadesImage" not found.
I am using the class on this function
`public function storeAvatar(Request $request) {
$request->validate([
'avatar' => 'required|image|max:7500'
]);
$imgData = Image::make($request->file('avatar'))->fit(120)->encode('jpg');
Storage::put('public/examplefolder/cool.jpg', $imgData);
}`
I have redownloaded Intervention, updated Composer, cleared cache, and nothing seems to work. Does anyone know any way to get rid of this issue?
Here is also the blade.php template I am using for more context:
`<div class="container container--narrow py-md-5">
<h2 class="text-center mb-3">Upload a New Avatar</h2>
<form action="/manage-avatar" method="POST" enctype="multipart/form-data">
@csrf
<div class="mb-3">
<input type="file" name="avatar" required>
@error('avatar')
<p class="alert small alert-danger shadow-sm">
{{ $message }}
</p>
@enderror
</div>
<button class="btn btn-primary">Save </button>
</form>
</div>`
dhurim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.