Display the folder image for the view Laravel

2019-01-20 18:10发布

问题:

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?

回答1:

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') }}">


回答2:

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">