If you want to keep the same aspect ratio but your images are different dimensions your best solution would be as Patsy Issa is saying.
Use css
#myimage{
background: url("myimage.jpg") no-repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
width:100%;
height:400px;
}
And HTML
<div id="container">
<div id="myimage"></div>
</div>
JSFiddle: http://jsfiddle.net/qBPy6/