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 a call to add_image_size like so:

if ( function_exists( 'add_theme_support' ) ) { 
    add_theme_support( 'post-thumbnails' ); 
}

if ( function_exists( 'add_image_size' ) ) { 
    add_image_size( 'sidebar_thumb', 109, 60 );
}

But then when I try to use that image size in my template...

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

The first image is 80X60, the second is 45 X 60; that's obviously way off.

images are not the size I wanted

=The height is right on both images. So I guess my question is how do I get an image outputted with an exact size, and if that's not possible by default, then how would I get the URL of a featured image (the image than the user picked as Featured in the admin section) so I can put that URL into a script like timthumb.

share|improve this question
1  
I found and recently downloaded the plugin "Regenerate Thumbnails" so maybe that can solve this issue... –  21zna9 Dec 8 '11 at 20:24
    
Regenerating thumbnails solves this problem. –  21zna9 Dec 8 '11 at 20:33
add comment

1 Answer

up vote 2 down vote accepted

Your not specifying a $crop value so your images are being cropped using a soft proportional crop. Set crop to TRUE for a hard crop.

add_image_size( 'sidebar_thumb', 46, 60, TRUE);

*no need to call function_exists for add_theme_support or add_image_size unless you want to be backwards compatible to pre 2.9.

share|improve this answer
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.