Posted By

LuckyShot on 12/01/09


Tagged

wordpress timthumb


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

vintagekrug
maxvee8
jirimelcak
techdetours


Wordpress - Image resized with TimThumb


 / Published in: PHP
 

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

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.

  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(); ?>" />

Report this snippet  

You need to login to post a comment.