Level 5
I found the issue. ->resize(50,50) is causing it to be blurry. Not sure how to resize it without blurry.
Here is my code below. It works but the uploaded image is blurry. Can someone help me figure out why and how to fix it?
public function updateProfile(Request $request)
{
$user_id = Auth::user()->id;
$user = User::findOrFail($user_id);
$user->name = $request->input('name');
$user->email = $request->input('email');
$user->address = $request->input('address');
$user->city = $request->input('city');
$user->state = $request->input('state');
$user->zipcode = $request->input('zipcode');
$user->homephone = $request->input('homephone');
$user->cellphone = $request->input('cellphone');
if($request->hasFile('avatar'))
{
$destination = 'uploads/profile/'.$user->avatar;
if(File::exists($destination)){
File::delete($destination);
}
$avatar = $request->file('avatar');
$filename = time() .'.'.$avatar->getClientOriginalExtension();
Image::make($avatar)->resize(50,50)->save(public_path('/uploads/profile/' . $filename));
$user = Auth::user();
$user->avatar = $filename;
}
$user->update();
return redirect()->back()->with('success', $user->name . ' has been updated');
}
I found the issue. ->resize(50,50) is causing it to be blurry. Not sure how to resize it without blurry.
Please or to participate in this conversation.