Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have several images that are wider than they are tall (landscape). The problem is that the theme I'm using crops images to 150x214px (taller than they are wide). This set up works for the majority of the images but there are still several left with the sides cut off. Is there anyway I can mass-crop the images that are wider than they are tall?

Here's what I mean: http://i.imgur.com/GQWMQ.jpg

The image on the left is wider so the sides get cut off. I want to add height to these images so the whole product fits like the image on the right.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

In media settings change:

Crop thumbnail to exact dimensions (normally thumbnails are proportional)

to unchecked. This will fix the problem on new images. For old already imported images, you'll need to regenerate them. There are many plugins that can do this.

This plugin is well known:

http://wordpress.org/extend/plugins/regenerate-thumbnails/

share|improve this answer
    
Ok, I did this and also regenerated the thumbnails using that plugin but the dimensions aren't changing. To further explain my situation, for example, I have an image that is 400x132. I need this image to match the aspect ratio of 150x214 which would make it 400x571. So basically I need to add height to the images that aren't tall enough to match the aspect ratio. Your suggestion didn't do this, unfortunately, perhaps due to my lack of clarification in the original post. –  Desi Aug 28 '12 at 14:11
    
You're saying they're no longer being cropped but they're not tall enough? I'm afraid WordPress won't add height, and it begs the question exactly what colour should these additional pixels be? Instead, wrap the images in a container div that has the correct height and width/aspect ratio, and then centre the image vertically using line-height and vertical-align. –  Tom J Nowell Aug 28 '12 at 14:34
    
Doing it that way ( html/css ) rather than by modifying the image itself would be faster, safer, and far, far less effort –  Tom J Nowell Aug 28 '12 at 14:34
1  
Thanks, I ended up wrapping the images in a container div and using css. –  Desi Aug 29 '12 at 0:41
    
Glad you got it working =] –  Tom J Nowell Aug 29 '12 at 8:58
add comment

If the above answer does not work, I believe you will need to make a modification in the theme functions file (functions.php).

You should find either set_post_thumbnail_size or add_image_size.

The functions take 3 and 4 parameters respectively but the last option should be a true or false and relates to cropping.

e.g.

add_image_size( 'news-image', 250, 190, true ); //name, width, height, crop

I suspect you may see a false or nothing listed for which false is the default.

If set to true the image will be cropped into the size exactly. A false setting will not change the aspect ratio.

More info can be found in the codex!

share|improve this answer
    
And just a thought... if you attempt this approach, you will need to use a thumbnail regeneration plugin as mentioned above! –  shanem Aug 30 '12 at 15:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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