0

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.

2
  • 1
    I found and recently downloaded the plugin "Regenerate Thumbnails" so maybe that can solve this issue...
    – 21zna9
    Commented Dec 8, 2011 at 20:24
  • Regenerating thumbnails solves this problem.
    – 21zna9
    Commented Dec 8, 2011 at 20:33

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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