0
This solution works in Public more folder when switching to Storage folder I can’t grab the image and display in the view someone can help me?
Controller
public function profile(){
return view('profile', array('user' => Auth::user()) );
}
public function update_avatar(Request $request){
if($request->hasFile('avatar')){
$avatar = $request->file('avatar');
$filename = time() . '.' . $avatar->getClientOriginalExtension();
Image::make($avatar)->resize(300, 300)->save( storage_path('/uploads/avatars/' . $filename ) );
$user = Auth::user();
$user->avatar = $filename;
$user->save();
}
return view('profile', array('user' => Auth::user()) );
}
Route
Route::get('profile',
'UserController@profile');
Route::post('profile',
'UserController@update_avatar');
View This was the call I made to return the image when it was in the public folder now that it does not work in the Storage folder, does anyone know how I can take the image from the Storage folder and display in the view?
<img src="/uploads/avatars/{{ Auth::user()->avatar }}">
Repository Gitlab https://gitlab.com/ronnyere/Laravel.git
You did all the procedure and created the link to the same folder is in the documentation?
– novic