开发者

the_post_thumbnail() without proportion

开发者 https://www.devze.com 2023-03-22 13:48 出处:网络
Is it possible to tell Wordpress to show the_post_thumbn开发者_如何转开发ail() without the proportion rate.

Is it possible to tell Wordpress to show the_post_thumbn开发者_如何转开发ail() without the proportion rate.

I need what the width and height to be exactly what I want

the_post_thumbnail(array(350,350));

If the image is larger than the height, it will only put the height to 350px and ignore the width that i've set to 350 too.

How could I hack this ?


Just use the timthumb method explained here: http://www.binarymoon.co.uk/demo/timthumb-basic/

Works great and will let you do exactly what you need after copying the timthumb.php into the proper WP Theme directory. Just pass your source image and the h x w of the exact size of your final cropped image, like so:

timthumb.php?src=castle1.jpg&h=350&w=350

Instructions and examples are provided by following the above link.

Good Luck!!

Marcelous


The $size is an optional parameter so there should be nothing wrong with doing the_post_thumbnail();

0

精彩评论

暂无评论...
验证码 换一张
取 消