Is there a way to fit an image inside a fix sized div without stretching it?
I have images than can be landscape or portrait to fit inside 250px divs, the problem is ut gets really stretched.
Actual images size:
Current result:
CSS-Code:
.container {
position: relative;
width: 250px;
height: 250px;
margin-bottom: 30px;
}
.container img {
width: 100%;
height: auto;
}
HTML-Code:
<div class="row text-center text-lg-left">
<div th:each="inst, iStat : ${instances}" class="container"
th:if="${inst.fileStatus} eq ${T(br.com.macrosul.stetho.entity.FileStatus).UPLOADED}">
<a href="#" class="d-block mb-4 h-100"> <img class="img"
data-target="#showMedia" data-toggle="modal"
th:data-slide-to="${iStat.index}"
style="width: 100%; height: 100%"
th:src="@{'/instances/' + ${inst.id} + '/thumbnail' + ${folder != null ? '?folder=' + folder.id : ''}}"
alt="">
</a>
</div>
</div>

