Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jeremihza's avatar

Image source not readable

if (!empty(Input::file('photo')) and Input::file('photo')->isValid()) {

        $destinationPath = "assets/images/profile/";
        Input::file('photo')->move($destinationPath, "$id.jpg");
        $path = public_path("assets/images/profile/$id.jpg");
        Image::make($path)->resize(
                150, null, function ($constraint) {
            $constraint->aspectRatio();
        }
        )->save($path);
    }

    Agent::where("id", $id)->update($data);
    \Session::flash('flash_message', 'Profile Update Successfully');
    return redirect('admin/profile');
}
0 likes
7 replies
munazzil's avatar

In this remove the .jpg because the second one is a varaible,

       Input::file('photo')->move($destinationPath, "$id");
    $path = public_path("assets/images/profile/$id");
chatty's avatar

the cause of the problem is here

Image::make($path)

you are passing a string here (image path)

instead you need to pass a file

Image::make(Input::file('photo'))

@jeremihza

jeremihza's avatar

$destinationPath = "assets/images/profile/"; Input::file('photo')->move($destinationPath, "$id.jpg"); $path = public_path("assets/images/profile/$id.jpg"); Image::make($path)->resize( 150, null, function ($constraint) { $constraint->aspectRatio(); } )->save($path); }

Agent::where("id", $id)->update($data);
\Session::flash('flash_message', 'Profile Update Successfully');
return redirect('admin/profile');

}

edit it in this cause im getting an error

chatty's avatar

have you tried what i said?

what error are you getting?

you need to explain your problem more clearly

Snapey's avatar

Please format your code by putting 3 backticks ``` on a line before and after each code block

Please or to participate in this conversation.