Css. How to fit image into container

Would try to describe my problem clear:
I have a container with fixed width where on the left side should be the image and on the right side should be the text field. And when the typed text go to the next string the height of container should be increase. At the same time we should proportional with the increasing height of container increase height and width of image and decrease the width of text field. So the image should be fit in container and at the same time don’t affect container height
I have like this simple html:

Do anyone know how to do it? Is here anyone mark-up geek?)

I tried to do it via position: absolute for the image, then the container can depend only on the height of the text field, but it is not clear how much to increase the width of this image, and accordingly reduce the text field. I also tried to simply position both the image and the text field via display: flex, but in this case, since the text field’s height changes dynamically – height: auto then the image stretches the container’s height