The WordPress post thumbnails functionality has become a basic necessity of theme coding, but it does have its limitations. Mainly you are stuck with the image sizes you specify in the Settings – Media tab. You can also specify your own image sizes, but clients undoubtedly want to change their image sizes over time or within one website over and over and over and over…. So it makes sense to make use of the dynamic image resizing script TimThumb. I use the following technique to grab the designated featured image post thumbnail from a post and then automatically resize it upon display. Works perfectly!
<!--?php // check if the post has a featured image assigned to it. if ( has_post_thumbnail() ) { // get the src of the large size featured image $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large' ); $thumbnailSrc = $src[0]; // output image resized with timthumb ?--> <a href="<?php the_permalink(); ?>"> <img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $thumbnailSrc; ?>&h=420&w=482" alt="" /> </a> <!--?php } ?--> |
From:http://dynabytes.net/wordpress/using-timthumb-with-wordpress-post-thumbnails/