Alex
Alex

Reputation: 483

Image not found with Laravel's blade

I'm using Laravel 5.1 andthe logic is: a user uploads an image. It goes not in the public directory but in the storage one (because I read that the storage directory is private). And I want to put the path to the image in the src=" " attribute but no image is found. I've tried:

<img class="getImage" src="http://localhost/bluedrive/drive/storage/uploads/1/DSC_8816.jpg">
<img class="getImage" src="C:\xampp\htdocs\bluedrive\drive\storage\uploads\1\DSC_8816.jpg">

But with no success...Why the pic is not found?

Upvotes: 0

Views: 1078

Answers (1)

ceejayoz
ceejayoz

Reputation: 179994

The storage directory is private. That means it's not accessible via the browser. If you want to display the image, you'll need it somewhere in public or you'll need to make a Laravel route that proxies the private images (potentially after first checking the user's permissions to see them).

Side note: C:\... syntax will never work for a website, and you should avoid explicitly writing out http://localhost/ sort of URLs. Use Laravel's url and asset helpers for this.

Upvotes: 1

Related Questions