JSFiddle - React, Tailwind, and code Playground
HTML
<table>
<tr>
<td>
<div>
<img onload="(function() { var parentSize = this.parentNode.clientWidth; this.style.width='auto'; if(this.clientWidth > parentSize) this.style.width = '100%'; }).call(this)" src="https://www.google.ru/images/srpr/logo4w.png"/>
<img onload="(function() { var parentSize = this.parentNode.clientWidth; this.style.width='auto'; if(this.clientWidth > parentSize) this.style.width = '100%'; }).call(this)" src="http://pictar.ru/data/media/24/nature__463_.jpg"/>
</div>
</td>
</tr>
</table>
CSS
div {
height: 100%;
width: 100%;
border:2px solid red;
}
div img {
max-width: 100%;
max-height: 100%;
width: 100%;
}