简体   繁体   中英

How to display in a blade view images stored in a external storage?

I want to use an external storage to save my images and display them in a blade

I've created a custom filesystem, where my images exist (In this case, my documents folder), but when I tried to display the images in a blade, they were not displayed

My custom filesystem:

'custom' => [
    'driver' => 'local',
    'root' => 'C:/Users/my name/Documents',
    'url' => 'http://localhost/halo/public/prueba',
    'visibility' => 'public',
],

The simple blade

<img src="{{ Storage::disk('custom')->url("pantalla.png") }}">

And the route

Route::get('/prueba', function () {
    return view('prueba');
});

http://localhost/halo/public/prueba show the broken imagen icon

And the source-code show this:

<img src="C:/Users/my name/Documents/pantalla.png">

Using this code the image display in html view using blade file but the image get from particular project directory. suppose the image stored in uploads/admin directory and image get from uing session or we can say that middleware

Add these code in blade file

<img src="{{url('/uploads/admin/'.\Session::get('admin')->profile_image)}}" alt="profile image">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM