How to scale up image into thumbnail without distorting it?
I have a section in my single post page that contains the post thumbnail. When using a smaller image as featured image (smaller than the thumbnail size, in width or height) it gets distorted to fill the thumbnail and lose its proportion. When the featured image is bigger than the thumbnail size or at least has a similar proportion, it seems to work just fine.
An image showing the case: http://i.imgur.com/XtdpuyV.jpg
Here's all the code I used:
add_image_size( 'thumbpost', 698, 320, true );
div class="thumbpost"?php { the_post_thumbnail('thumbpost' ); } ?/div
.thumbpost{
width:100%;
height:320px;
overflow:hidden;
}
.thumbpost img{
width:100%;
height:100%;
}
Wordpress generates an image maintaining the original width, that is smaller than the thumbnail's width that I want
Topic post-thumbnails scale Wordpress
Category Web