I'm having these 3 images with different sizes. When I display them inside 3 containers like this:
@foreach (var item in Model) {
<div class="avatar-container">
<img class="avatar img-thumbnail" src="@Href("~/Content/Avatars/",item.Name+".jpg")" />
</div>
}
This is my CSS file:
div.avatar-container {
display: inline-block;
max-height: 50px;
overflow: hidden;
width: 70px;
}
.avatar {
width: 100%;
height:auto;
overflow: hidden;
}
And also img-thumbnail is from bootstrap.css (line 368). After a while I've managed to crop images (using overflow property) so that the each avatar is displayed as 70x50 thumbnail.
Take a look at these 3 returned thumbnails: image
[PROBLEMS]
image1. It also cropped the nice bottom part of my thumbnail.
image2. Well I would think that thumbnails are squares, not rectangles.
image3. How do I crop to the middle of the image (in both vertically and horizontally manners)?
Here's what I came up with, using JavaScript and another thumbnail container.
The final results look like this