Wordpress - Image resized with TimThumb

/ Published in: PHP
Save to your folder(s)

TimThumb should be in the template folder named as "thumb.php".
Change H (height in px), W (width in px), Q (quality 0-100), ZC (zoom cropping 0-1) values.
You can provide only one of the dimensions of the picture to get a proportional scale.

Copy this code and paste it in your HTML
  1. // Image loaded from a Custom Field
  2. <img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo get_post_meta($post->ID, "image", $single = true); ?>&amp;h=75&amp;w=75&amp;zc=1&amp;q=90" alt="<?php the_title(); ?>" />
  3. // Image loaded from images folder in template
  4. <img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo bloginfo('template_url'); ?>/images/picname.jpg&amp;h=75&amp;w=75&amp;zc=1&amp;q=90" alt="<?php the_title(); ?>" />
  5. // Image URI hard-coded
  6. <img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=http://www.xaviesteve.com/image.jpg&amp;h=75&amp;w=75&amp;zc=1&amp;q=90" alt="<?php the_title(); ?>" />

URL: http://code.google.com/p/timthumb/

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.