My website allows users to upload images, and the server processes them to a size of 400px*400px. The original sizes of the images vary, making it challenging to display them properly within a 200px*200px div. I'm looking for a way to crop the images while maintaining the correct ratio and centering them using jquery/css. Any known methods to achieve this?
Edit
.container{width:200px; height:200px;}
.container img{width:100%;}
The solution above is close but not entirely satisfactory as it adjusts the height/width based on the image. Currently, we are using a letterbox method to scale the images. Additionally, I came across Pixel Daily's photo stack plugin which can be found here.