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 want to add a custom image size for each image, that is uploaded into posts (via the uploader). I found code-examples on several websites, but somehow they just don't work for me. This is (the relevant part of) my code inside the functions.php:

function ts_custom_image_sizes(){
    add_theme_support('post-thumbnails');
    add_image_size('ts-menu', 122, 62, true);  
}
add_action('after_theme_setup', 'ts_custom_image_sizes');

function ts_choose_custom_images($sizes) {  
    $custom_sizes = array(  
        'ts-menu' => __('Image for the menu right', 'tsdomain')
    );
    return array_merge( $sizes, $custom_sizes );  
}
add_filter('image_size_names_choose', 'ts_choose_custom_images');

I have to mention that my option is displayed in the uploader of wordpress, but it's greyed out (not selectable). And there's no image created in the uploads-folder with the dimensions I set (122x62), just with the standard-dimensions. I also tried to disable the theme and reload it, but that didn't help, too.

share|improve this question
    
are you uploading images after adding the size? –  Milo Jul 27 '12 at 16:13
    
yes, after adding the size. –  lupor Jul 27 '12 at 17:13

1 Answer 1

I had the same problem and found out the php-gd library wasn't installed on my server.

Installed it with

yum install php-gd

restarted and it worked like a charm!

share|improve this answer

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.