i would like to show a picture in html file i go to the link folder public/storage/image is empty but in the storage/image i find the file and its also saved in the data base.*
@foreach($cvs as $cv)
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<img src="{{ asset('storage/'.$cv->photo) }}" alt="...">
<div class="caption">
<h3>{{ $cv->titre }}</h3>
<p>{{$cv->presentation}}</p>
<p>
<a href="#" class="btn btn-primary" role="button">Afficher</a>
<a href="#" class="btn btn-success" role="button">Modifier</a>
<a href="#" class="btn btn-danger" role="button">Supprimer</a>
</p>
</div>
</div>
</div>
@endforeach
</div>
</div>
The
public
disk is intended for files that are going to be publicly accessible. By default, thepublic
disk uses the local driver and stores these files instorage/app/public
. To make them accessible from the web, you should create a symbolic link frompublic/storage
tostorage/app/public
. Laravel docCreate Symbolic link in Linux
As Mayank Majithya notes, a symbolic link is one common way to access
storage/app/public/
files from thepublic/
directory, and in fact the method the Laravel docs say you should use.If you are on shared hosting that disallows this, you could also try to use Laravel's
storage_path()
helper function, like so:<img src="{{ storage_path('subpaths/under/storage/filename.jpg') }}">
(reference).I also notice you mention the images are stored in the database. If you mean the whole file is stored, it may be more efficient (once you have the file path figured out) to store only the file path in your database, rather than the whole file (since it is already stored on disk). You can then use your model to get the path (assuming your table has columns for, say, 'src' and 'alt'):
solved it with just a simple modification on the filesystems config/file systems from :
to :