I use laravel 5.3 and am having this problem:
When I try to use a route that returns an image of a particular user from my system, follow the code below.The Response content must be a string or object implementing __toString (), "object" given,
Here is the action
of controller
that returns the image.
public function getImage($filename)
{
$file = Storage::disk('local')->get("/avatars/".$filename);
return new Response($file, 200);
}
Route
Route::get('getImage/{filename}', 'TeatcherController@getImage')
->name('get.image')
->middleware('auth');
Using the route to get the image
<img src="{{ url(route('get.image', ['filename' => $user->teatchers->photoName] )) }}" alt="{{$user->teatchers->photoName }}">