我正在tryng來調整用戶輪廓的圖像,但我有此錯誤:Laravel 5.2 - Intervation圖像調整
NotReadableException in Decoder.php line 96: Unable to init from given binary data.
我的控制器
public function updateAvatar(Request $request){
if ($request->hasFile('image')) {
$user_id = Auth::user()->id . '.' . $request->file('image')->getClientOriginalExtension();
// if i insert here: retur $user_id it return: 1.jpg it work well,
// my form work well, before i tryed to upload without resize and it work well.
// i want save image uploaded with id user and extention
// here i'm tryng to resize it, i installed intervation and inserted class
$img = Image::make('images/users',$user_id);
$img->resize(100, 100);
$img->save('images/users',$user_id);
$user = new User;
$user->where('email', '=', Auth::user()->email)
->update(['image' => 'images/users/'.$user_id]);
return redirect('account')->with('message-success', 'Immagine profilo aggiornata con successo!');
}else{
return redirect('account')->with('message-error', 'File non trovato');
}
}