WordPress – Cropping thumbnails without losing quality

I have a website on which there is a “shop” page. Each product has a thumbnail assigned to it.

I set a custom thumbnail size with this code:

Read More
if ( function_exists( 'add_image_size' ) ) { 
   add_image_size( 'products', 150, 84, true );
}

Cropping works fine, but when the image is too tall WordPress crops it to the “height” parameter and the final result is a thumbnail too narrow to look good.

Is there a way to make WordPress select a part of an image (150×84 px fragment) and use it as a thumbnail instead of resizing the image? It is important for thumbnails to stay at 150×84 px EXACTLY while not being too narrow or too short.

Related posts

Leave a Reply

2 comments

  1. I have found an answer.

    Even if WordPress does crop images while using the function I used here, it may do it improperly until thumbnails are regenerated. Short answer is: WordPress cropped my images, but it was flawed due to thumbnails not being regenerated.

    To regenerate them please use this plugin:

    Regenerate Thumbnails