zibizib
zibizib

Reputation: 1

the_post_thumbnail(array(X,Y)) doesn't work well

The size of my posts’ featured images is 700x400 or more, and in order to display them center-cropped to 300x400 I use :

the_post_thumbnail(array(300,400)); 

However this code displays everything except a 300x400 image. Anybody could tell me how to achieve what I want ?

Upvotes: 0

Views: 8480

Answers (3)

Engr Saddam Zardari
Engr Saddam Zardari

Reputation: 1049

try out this

<?php echo the_post_thumbnail(array(32,32)); ?>

You can Increase size on desire

Upvotes: 0

Gavin
Gavin

Reputation: 2567

See here: http://gavinsmith.me/2010/10/multiple-post-thumbnail-featured-image-sizes-in-wordpress/

You can dig a bit further than using only the_post_thumbnail and actually create your own image sizes. Then, using the_post_thumbnail, you can call the image - but the version you have created using add_image_size, as described on that page. Let me know if I lost you there.

Upvotes: 0

Shakti Singh
Shakti Singh

Reputation: 86346

As the function manual says:-

PLEASE NOTE: The crop does not work in Wp 3.0+. All that is needed for WP 3.0+ is the call for the thumbnail to post. Then proceed to media in the dashboard and set your thumbnail to crop to the size you wish to use.

http://codex.wordpress.org/Function_Reference/the_post_thumbnail

Upvotes: 2

Related Questions