Darren Hoyt who is one of the best Web Designer out there (in my sense!) and he is providing an auto image cropping php script called TimThumb on his website. When you deploy a project for a customer, last thing you want to do is have them manually resizing the pictures and cropping them before uploading them to the CMS. And this is especially true with WordPress. TimThumb is a really nice piece of code and it also provide caching so the process is not run every time a page is loading. Here is the link with all the instruction:
http://www.darrenhoyt.com/2008/04/02/timthumb-php-script-released/
Most important thing is to chmod the script folder subfiles and folder to 777 in order to have it work correctly. Here is an example on how to use it in WordPress:
<a title="<?php the_title();?>" href="<?php the_permalink(); ?>"> <img alt="<?php the_title();?>" src="<?php echo get_bloginfo('template_url') .'/scripts/timthumb.php?zc=1&w=306&h=217&src='.get_thumb_url($post->ID);?>" /> </a>
This example is part of the WordPress Loop. You can change the w and h value in the script URL to modify the image width and height. Best way to do it will be to have these setting part of the WordPress The Options panel. The get_thumb_url() is a custom function we have built to retrieve the value of the post thumbnail which is available since WordPress 2.9. We will cover this function in an article later on.
Leave Your Response