Reputation: 55
I'm trying to upload image to display it in view, but when I try to display it, it doesn't show on image section of my view.
I already have symlink, and it works. I can see my uploaded image in 'public/storage/images' path. It also shows up on 'storage\app\public\images' path.
My code to display the image
@if(filled($book->image))
<img src="{{asset($book->image)}}" style="width: 8%;height:8%">
My code for the image upload
if ($request->hasFile('book_image')) {
$book->image = $request->file('book_image')->storeAs('public/images', $request->id . '.' . $request->file('book_image')->getClientOriginalExtension());
}
Upvotes: 0
Views: 1062
Reputation: 270
Rewrite your code like this
<img src="{{asset('images/'.$book->image)}}" style="width:8%; height:8%">
This should work if you already run storage:link
in your command line
Upvotes: 0
Reputation: 1206
if you want to get the image url in blade then you can use url helper like img src="{{ url('storage/app/public/images/'.$filename) }}"
or elsewhere like
storage_path('/app/public/images/' . $filename)
Upvotes: 0