0

I'm using WP Job Manager, and would like user-uploaded logos to be resized and positioned to fit within a fixed height and width. Currently, my settings are at:

enter image description here

When I am uploading the following image (250x169):

enter image description here

This is what I get:

enter image description here

But what I want to have the image resized to fit a fixed width and height of let's say 150x150, like so:

enter image description here

I tried unchecking the "crop thubmnail to exact dimensions..." in settings, the image is then just resized (like to 150x68, not 150x150 without cropping)

I tried adding the following to my theme's functions.php:

add_image_size( '150x150-crop', 150, 150, false );
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 150, 150, true );

Nothing makes a difference. Any ideas?

0

What you're apparently asking for isn't possible. WordPress will never add white space to an image to make it fit a certain size. This is what cropping means. Cropping will always remove (i.e. crop) some of the image so that it fits a certain size. As far as I am aware, there is no tool that ever refers to adding space as 'cropping', so WordPress' behaviour is the expected behaviour.

So your only options are to resize the image, keeping the proportions (your 3rd image), or removing some of the image to fit the desired dimensions (your 2nd example).

If you want images to fill specific dimensions without being cropped, you will either need to upload them at the desired dimensions originally, or if they're being used in a specific way in a specific template, use CSS to position the uncropped images the way you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.