Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I added the following to my functions.php file:

set_post_thumbnail_size( 500, 500);

I enabled featured image (support => 'thumbnail') in a custom post type a created (called Page Content).

When I set an image as featured image (the image I'm using has 500px of height) , the image is always rendered with 198px of height.

EDIT:

It renders 198px in final page and 117px in the admin panel.

This is the code of the final output:

<img class="attachment-post-thumbnail wp-post-image" width="448" height="198" title="2974999772_7085da4d34" alt="2974999772_7085da4d34" src="http://localhost/wp-alex-chen/wp-content/uploads/2011/01/2974999772_7085da4d344-448x198.jpg

This is the code of the featured image in the admin panel:

<img width="266" height="117" title="2974999772_7085da4d34" alt="2974999772_7085da4d34" class="attachment-post-thumbnail" src="http://localhost/wp-alex-chen/wp-content/uploads/2011/01/2974999772_7085da4d344-448x198.jpg">

Edit Post panel:

enter image description here

Any suggestions to solve this? (the 'normal' Posts have also the same problem (height= 198px)

EDIT2: I aded this to functions.php:

if ( function_exists( 'add_image_size' ) ) add_theme_support( 'post-thumbnails' );
if ( function_exists( 'add_image_size' ) ) {
    add_image_size( 'thumb-1', 320, 280, true );
}

It is set to have hard-crop but the image is rendered as 250px 280px (it should render as 320px x 280px).

share|improve this question
@janoChen - Where is it always rendered 428px x 198px? What does the code look like that renders it? (Details are your friend.) – MikeSchinkel Jan 31 '11 at 11:49
@MikeSchinkel I added that in the EDIT. – janoChen Jan 31 '11 at 11:56
@jano: Please post that images original pixel size and aspect ratio. Then compare that with your thumbnail images aspect ratio. IIRC wordpress will always use the smallest size of any side not to cut stuff away. – hakre Jan 31 '11 at 12:40
@janoChen - Not sure I know how to fix this without seeing your system. Maybe someone else can solve it. – MikeSchinkel Jan 31 '11 at 12:46
@hakre the original picture is 280px x 320px, for some reason Wordpress is now making it 280px x 280px. Even if I'm using this: add_image_size( 'thumb-1', 320, 280, true ); – janoChen Jan 31 '11 at 12:48
show 2 more comments

2 Answers

I think you are using a child theme of TwentyTen and in TwentyTen theme you have this line:

set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );

and HEADER_IMAGE_HEIGHT is 198px.

share|improve this answer
commenting out this code fixed this issue for me thanks – Xavier Oct 6 '11 at 13:15

Using <?php the_post_thumbnail('large'); ?> instead of <?php the_post_thumbnail(); ?> fixed the problem.

<?php the_post_thumbnail(); ?> seems to have a very weird default setting for resizing thumbnails.

share|improve this answer
2  
the_post_thumbnail() in Codex has note about crop not working somehow with it. I am not sure about specifics but I think that is likely what caused your issues. – Rarst Jan 31 '11 at 13:19
@Rarst: I'm smelling the same, I wish Jan could add two cents, he probably knows best. – hakre Jan 31 '11 at 13:29

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.