.container {
width: 500px;
height: 250px;
}
.container img {
width: 100%;
height: 100%;
object-fit: cover;
}
<div class="container">
<img src="xxxxx.jpg" data-object-fit="cover">
</div>
<script src="js/objectFitPolyfill.min.js"></script>
Resource:
https://github.com/constancecchen/object-fit-polyfill