1

I am using the wordpress function the_post_thumbnail(); but it seems to behave differently in different places. I have the following code on one page:

the_post_thumbnail(array('275', '190'));

Does exactly what it's supposed to, i get a thumbnail exactly 275 x 190 that has been cropped to fit. I then paste this code to a different template and this time the image has been resized to the maximum dimension, either 275 wide if its landscape or 190 if its portrait.

Anyone know whats going on?

migrated from stackoverflow.com Jul 1 '11 at 22:14

This question came from our site for professional and enthusiast programmers.

2

Sure - the method of cropping/ resizing the thumbnail is normally determined in the templates functions.php file. Look for something along the lines of:

<?php set_post_thumbnail_size( $width, $height, $crop ); ?> 

The third parameter is the method of cropping, a boolean. Set it to true and it will crop the image exactly, set it to false and it will resize the image close to the dimensions you provide.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy