JSFiddle - React, Tailwind, and code Playground
HTML
<div class="test1">
<img src="http://placekitten.com/g/700/300" /><br>
<img src="http://placekitten.com/g/500/300" /><br>
<img src="http://placekitten.com/g/300/300" /><br>
<img src="http://placekitten.com/g/300/700" /><br>
<img src="http://placekitten.com/g/500/700" /><br>
<img src="http://placekitten.com/g/700/700" />
</div>
CSS
.test1, .test2 {
outline: 5px solid;
margin: 20px;
}
JavaScript
$(function(){
$('.test1 img').each(function(){
$(this).width(($(this).height() > $(this).width())?'60%':'95%');
});
});