P
P
Programmir2018-02-25 15:37:59
Laravel
Programmir, 2018-02-25 15:37:59

How to display an image using Laravel?

In config.filesystems, I set the default folder images
'default' => env('FILESYSTEM_DRIVER', 'images'), and created a disk
'images' => [
'driver' => 'local',
'root' => storage_path ('app/images'),
],

Now my images are stored in storage/app/images.
But how to display this image?
In the console, I wrote php artisan storage: link And in public I got an empty Storage folder.
In the blade template I write the following < img src="<?php echo Storage::url('app/images/'.$art->image); ?>" alt="" >
That is,
I added the following lines to the images disk : 'url' => env('APP_URL').'/storage',
'visibility' => 'public',

but to no avail. Everything is taken from the database - the title of the news headline, the text, the title of the picture, but the link is not displayed. How to make an image appear from Storage/app/images?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Antonio Solo, 2018-02-25
@solotony

there is no direct access to /storage/app/images via http
you need to create a symlink with storage/app/images somewhere in public/images
it should not be a folder but a symlink

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question