mistre83's avatar

Show image in view stored in storage

Hi to all, i've created a new storage in this way

'images' => [
            'driver' => 'local',
            'root' => storage_path('app/public/images'),
            'visibility' => 'public'
        ],

Then, i upload my photo with:

Storage::disk('images')->put('image.jpg', file_get_contents($source_image_path));

This store the file image.jpg in storage/app/public/images

Now, i would like to display this image from a Blade.

With this command, i get TRUE as result (so, the file exists):

Storage::disk('images')->exists('image.jpg');

But, how i can display this image on <img src="" /> tag ?

0 likes
9 replies
ejdelmonico's avatar

As @Snapey referred to, you must run php artisan storage:link to make image publicly available. The link would then be at storage/your-image.jpg.

1 like
pay2all's avatar

i changed public to ../public_html,

[ErrorException] symlink(): No such file or directory

when i run command : php artisan storage:link

guillermo_rojas's avatar

I have the same issue. The file already exists in

storage/app/public/photos/users/Gxs0vH7AIDnR7oCywFiHLwj1zEbJ9LHymU6NmV3W.jpeg

I've already made

php artisan storage:link

Now, how can I show this picture?

I've tried

<img src="/storage/app/public/photos/users/Gxs0vH7AIDnR7oCywFiHLwj1zEbJ9LHymU6NmV3W.jpeg">

and did not work :(

omankopyor's avatar

Try

<img src="{{ url('photos/users/'.$filename) }}" >
Snapey's avatar

@omankopyor please take note of how old the post is please. I doubt they are waiting for your answer.

1 like
abdulhalimmanik's avatar

Following code is not working. How can i show image from local disk.

Storage::disk('local')->url('avatar/707f10b4f9d81b7e12255c16b68f41e8.jpeg') }}.

I put it on img tag.

Please or to participate in this conversation.