@foreach ($profiles as $profile)
<tr>
<td>{{ $profile->id }}</td>
<td>{{ $profile->email }}</td>
<td>{{ $profile->name }}</td>
<td>{{ $profile->age }}</td>
<td>{{ $profile->gender }}</td>
<td>{{ $profile->position }}</td>
<td>{{ $profile->department }}</td>
<td>{{ $profile->phone_number }}</td>
<td>
@if ($profile->images)
** <img src="{{ asset('storage/app/public/'.$profile->images) }}" alt="Profile Image"
style="max-width: 50px; border-radius: 50%;">**
@else
No Image
@endif
</td>
I already try using URL in asset, but it didn’t work at all, I already make the storage folder short but it didn’t help me at all
3
Answers
I don’t think you are linking it correctly with asset and prefix. try
It will look for an image inside of a public/storage folder where you can define your own image folder
please check below steps:
Try save image location absolute instead of relative URL location in this case you should just put image URL location directive
if you want to save location in relative mode first of all check storage connect to your project or not
in laravel you can use:
in Linux you can use:
and then use your code to show the img
You can check these things:
.env
file andAPP_URL
value: it should behttps://[yourwebsite.com]
– some people forget to change it from the defaultlocalhost
or provide incorrect URL with an extra folder/subdomainstorage/app/public
, check if you have runphp artisan storage:link
successfully (so, no errors happened) to create the symlink./public
folder of the Laravel project.storage/app/public
images withasset('storage/'.$profile->images)
Check the docs here: https://laravel.com/docs/10.x/filesystem#the-public-disk
By the way, I would rename the variable from
images
toimage
, as it seems to be a single image and would likely be misunderstood by future developers.