kfiroj236's avatar

getting error by uploading profile picture

this my code for uploading profile pic and it is my controller page code public function updateavatar(Request $request) { if ($request->hasFile('avatar')) { $avatar = $request->file('avatar'); $filename = time().'.'.$avatar->getClientOriginalExtension(); Image::make($avatar)->resize(300,300)->save(public_path('/uploads/avatars/'.$filename)); // dd($avatar);

    } else {
        # code...
    }

and this is my view page

Upload your Image
            </form>

but when I run this code it gives me a error like Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Class 'App\Http\Controllers\Recruiter\Image' not found

How I can solve it help me in this code.

0 likes
4 replies
tykus's avatar

You need to import it - at the top of your controller:

use Intervention\Image; // assuming Intervention!

class ...
1 like
kfiroj236's avatar

its not working it gives this error "Class 'Intervention\Image' not found"

tykus's avatar

Well, as I said I assumed Intervention - what Image dependency have you installed?

1 like
kfiroj236's avatar

Thank you it helpful for me and I solved this problem.

Please or to participate in this conversation.