Display the folder image for the view Laravel

2019-01-20 18:21发布

How can I access a direct image from storage?

I'm saving the images from my project in storage/images/clients/ how do I retrieve those images and display them for the view?

2条回答
Animai°情兽
2楼-- · 2019-01-20 18:34

To retrieve the raw content of the file use:

$contents = Storage::get('/path/to/file.jpg');

But if you just trying to display it in the view, there no need for any special cumbersome method, Simply use

<img src="/path/to/file.jpg">
查看更多
Bombasti
3楼-- · 2019-01-20 18:45

You need to create a symbolic link between the storage/images and public/images:

ln -s /full/path/to/storage/images /full/path/to/public/images

Then you'll be able to use these images:

<img src="{{ asset('images/clients/john.jpg') }}">
查看更多
登录 后发表回答