I`m trying to create a profile screen for my website with an uploaded profile picture. I want the user’s uploaded image to fill the container. As this would ensure that all of the profile pictures are the same size and in the same place
<div class="row d-flex justify-content-center">
<div class="col-4 align-self-center border border-danger" style="width: 190px ;height: 190px; border-radius:70%;">
@if ($profile_picture != null)
<img src="{{ $profile_picture }}" style="border-radius:70% ;width:auto; height:auto; object-fit: fill;">
@else
<svg xmlns="http://www.w3.org/2000/svg" width="auto" height="auto" fill="currentColor" class="bi bi-person-circle" viewBox="0 0 16 16">
<path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/>
<path fill-rule="evenodd" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"/>
</svg>
<i class="bi bi-person-circle"></i>
@endif
</div>
</div>
The current code makes it look like this(I put a border on the container to make it easier to see)
2
Answers
You mean something like this?
Setting img width to 100% instead of auto mainly.
You could also remove border-radius from img, and set overflow on the border div.
Very easy. I used another code but u can apply it to your code