How to Use TimThumb with WordPress Featured Images

The TimThumb is one of the most popular resizing web images script, a lot WordPress themes use this simple easy tool to crop the images, especially the WordPress magazine themes.

Usually, a lot WordPress theme use TimThumb resizing the first images in the post, however, with the developing of the WordPress, a featured images feature comes out, more people want to use the TimThumb to crop the featured images in the post.

If you want to re-size the WordPress featured image use timthumb, use the following code in the loop.

$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_url($image_id);
<img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo $image_url; ?>&w=400&h=300&q=100" alt="<?php the_title();?>" />

You can use the code replace the feature image code in the loop:

 <?php the_post_thumbnail( 'thumbnail' ); ?>