How resize and crop thumbnail image to a particular height and width in WordPress?

Presently I am doing a project in WordPress. It’s a daily news update site.
My layout goes like this:

enter image description here

Read More

In the above Layout I set the images of posts by Featured Post Images and displayed by using the get_the_post_thumbnail(postid). While using this function my image getting stretched and distorted.

And I tried another way by passing size attribute to above function like medium and large, but no luck.

My question can we get two predefined like (830px/542px and 800px/330px) sizes of images at a time while uploading any size of image to a WordPress.

I tried some plugins that are available in WordPress, but there is no luck in that either.

Related posts

Leave a Reply

3 comments

  1.     use a plugin like the Ajax Thumbnail rebuilder. OR
    
        Go to your functions.php and look for this code
    
             add_image_size( 'properties', 280, 200, TRUE );
    
        280 is the width and 200 is the height in pixel.
    
        This should solve your problem
    
  2. You could use add_image_size(). Throw a couple of those in your theme functions.php file or a plugin you are creating for this. This will create an appropriately sized image for every image you upload in the admin. It will not, however, upscale an image. Thus this will only create an image of 830px/542px and 800px/330px if the source image is larger than that. This should be fine though.

    Hope that helps.