Support the ongoing development of Laravel.io →
posted 2 years ago
Laravel
Last updated 2 years ago.
0

You should always use the public directory. The storage folder is not public and should not be by any means. Also use asset() function whenever you try to load images/js/css which points directly to your public directory. Example: <img src="{{ asset('images/example.jpg') }}" />

zeriz liked this reply

1

Thanks geowrgetudor,

Let me explain my issue bit more.

i have used the artisan:link command.

my public images are stored in /storage/app/public/images

my filesystem configs look like:

'links' => [ public_path('storage') => storage_path('app/public'), ],

Why can a visitor see my image at:

http://site.test/images/image.jpg and also at http://site.test/storage/images/image.jpg

when i look at my filesystem there is a symlink from storage to /storage/app/public

I expect that only http://site.test/storage/images/image.jpg should work.

i'm just a bit confused thats all :)

0

By any chance do you happen to have the same files duplicate inside the public/images? I don't see any other reason for this to happen.

0

Strange isnt't it. I never changed configs for this. And no i don't have a image directory in public, only a css and js folder.

As long it only happens with the images folder in public i think i have to live with it :)

Is see most laravel sites i checked use /images. i can't imagine everyone changed their config.

Thanks for replying

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.