Here’s a little trick that works nicely in modern browsers:
<img src="..." style="width:100%;max-width:000px;">
This image will now shrink to fit the width of the layout (
width:100%) but won’t go wider than it’s own image size (
max-width:000px where you replace
000 with the image’s pixel width).
Browsers should scale both X and Y even if only the X constraint (width) is set. In other words, only setting width and not height as well shouldn’t screw up the aspect ratio of the image.
The upside is images that won’t cause a fluid layout to break if the layout is narrowed to a width smaller than the image.