brunelli
brunelli

Reputation: 315

images not accessible from public storage folder

I try to access an image that is in following location:

storage/app/public/uploads/myImageIsHere.jpeg

I have tried all stack overflow options, public_path, Storage::url, creating a symlink link and thousands others.

Can someone explain me how to access this image in my .blade file ??

<img src="{{ Storage::url("app/sponsors/8R4HnbOzDdUilnSaZSRj9VzmeI7oKI9JrCWe3rgY.jpeg") }}">

GET http://127.0.0.1:8000/storage/app/sponsors/8R4HnbOzDdUilnSaZSRj9VzmeI7oKI9JrCWe3rgY.jpeg 404 (Not Found)

And this returns a correct path according to my img src path.

Thanks a lot!

Upvotes: 0

Views: 830

Answers (3)

konstantinkoslow
konstantinkoslow

Reputation: 287

Run php artisan storage:link to create a symlink to your public storage disk. After that you can access your image like that:

<img src="{{ 'storage/uploads/8R4HnbOzDdUilnSaZSRj9VzmeI7oKI9JrCWe3rgY.jpeg' }}">

Upvotes: 0

Damith
Damith

Reputation: 114

Did you try ,

Storage::get("app/public/uploads/myImageIsHere.jpeg");

https://laravel.com/docs/5.8/filesystem

Upvotes: 1

Aditya Tomar
Aditya Tomar

Reputation: 890

use this instead

<img src="{{ URL::to("/images/abc.jpg") }}">

this will return an image namely abc.jpg inside "public/images" folder.

Upvotes: 0

Related Questions