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>
use Illuminate\Support\Facades\Storage; $url = Storage::url('file.jpg'); When using the local driver, all files that should be publicly accessible should be placed in the storage/app/public directory. Furthermore, you should create a symbolic link at public/storage which points to the storage/app/public directory.
What is php artisan storage link? php artisan storage:link. Once a file has been stored and the symbolic link has been created, you can create a URL to the files using the asset helper: echo asset('storage/file. txt'); You may configure additional symbolic links in your filesystems configuration file.
How can I get Laravel storage file? Laravel's filesystem configuration file is located at config/filesystems. php . Within this file, you may configure all of your filesystem "disks".
First of all in the .env file create a variable named FILESYSTEM_DRIVER and set it to public
like this
FILESYSTEM_DRIVER=public
and then create symbolic link by run
php artisan storage:link
after that just use asset()
<img src="{{ asset('storage/'.$cv->photo) }}" alt="...">
It'll work fine 😊
The public
disk is intended for files that are going to be publicly accessible. By default, the public
disk uses the local driver and stores these files in storage/app/public
. To make them accessible from the web, you should create a symbolic link from public/storage
to storage/app/public
. Laravel doc
Create Symbolic link in Linux
ln -s source_file myfile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With