<!DOCTYPE html>
<style>
    div.container {
        -webkit-writing-mode: vertical-rl;
        inline-size: 80px;
        block-size: 200px;
        outline: solid blue;
    }

    img {
        background-color: red;
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 100%;
    }
</style>
<div class="container">
    <img src="data:image/svg+xml,<svg width='120' height='240' xmlns='http://www.w3.org/2000/svg'><rect x='0' y='0' fill='green' width='120' height='240'></rect></svg>">
</div>
<div style="height: 25px;"></div>
<div class="container">
    <img src="data:image/svg+xml,<svg width='60' height='80' xmlns='http://www.w3.org/2000/svg'><rect x='0' y='0' fill='green' width='60' height='80'></rect></svg>">
</div>
