hachiman's avatar

Intervention image Missing argument 1

So i have this image upload function
And i want to give a uploaded image the user->id but when i do

public function avatarupload($id) {

I get:

ErrorException in ProfilesController.php line 73:
Missing argument 1 for App\Http\Controllers\ProfilesController::avatarupload()
public function avatarupload($id = 1) {
        
        $user = User::find($id);
        $input = Input::all();
        
        if (Input::hasFile('avatar')) {
            $input = Input::all();
            $fileName = 'avatar_'.$user->id;
            $image = Image::make($input['avatar']->getRealPath());
            $image->save(public_path() . '/upload/profile/avatars/'.$fileName)
                        ->resize(300, null, function ($constraint) { $constraint->aspectRatio(); });
        }
}

I have no clue to what to do here

im using https://github.com/Intervention/image

0 likes
1 reply

Please or to participate in this conversation.