How to crop thumbnail height to auto with set width

I’m looking for a way to only set the width of a thumbnail size and let the height set auto. So if I have two images. One is 600px/420px and one is 600px/600px. I want to set only the width of the thumbnail to 200px so wordpress crops the thumbnails of the above dimensions to 200px/140px and 200px/200px. Any ideas?

1 Answer
1

In your theme’s functions.php file:

/* register new image size
 * 200px wide and unlimited height
 */
add_image_size( 'wpse73058', 200, 9999, false );

In a template or the like:

if ( has_post_thumbnail() ) { the_post_thumbnail( 'wpse73058' ); }

Leave a Comment