cropResize does not work as expected for images in portrait format

I’m using the following code to list a bunch of articles with an image each. The image part is:

{{ image.cropResize(300,300).html('','Foto','right dreh'~drehgrad) }}

This works a treat for landscape shaped images, they get resized to a width of 300px and the appropriate height. However, portrait pictures also get resized to a width of 300px and correspondingly a much larger height. This isn’t quite what I expected – I would like the longer side of the image, whichever that is, to be 300px, and the other to rescale accordingly. How can I do this?

UGH so I finally figured it out – cropResize was working fine, just my CSS was messed up. I hadn’t accounted for the standard img { width: 100%; }