If the image is in a container with a responsive width:
HTML
<div class="img-container">
<img src="" alt="">
</div>
CSS
.img-container {
position: relative;
&::after {
content: "";
display: block;
padding-bottom: 100%;
}
img {
position: absolute;
width: 100%;
height: 100%;
object-fit: cover;
}
}