Timthumb is an awesome little PHP script, basically it auto creates a thumbnail from an uploaded image and it is mostly used in blogs. Many themes come with timthumb included but today I’m going to show you how to integrate it into your WordPress theme, and troubleshoot any server issues that can prevent it from working.

You can download the timthumb.php file from here: http://code.google.com/p/timthumb

Let’s get this started:

First thing I generally do is create a folder called “scripts” in the template folder (same location as index.php, sidebar.php etc..) then CMOD the folder to 755, then inside the “scripts” folder create a folder called “cache” and also CMOD it to 755.


Open Timthumb.php and find the following lines:

$new_width = preg_replace ("/[^0-9]+/", ”, get_request(‘w’, 0));
$new_height = preg_replace ("/[^0-9]+/", ”, get_request(‘h’, 0));

Edit the width and height to your desired thumbnail size, so for example if we wanted a 150px x 150px thumb we would do this:

$new_width = preg_replace ("/[^0-9]+/", ”, get_request(‘w’, 150));
$new_height = preg_replace ("/[^0-9]+/", ”, get_request(‘h’, 150));

Once you have finished editing upload the “timthumb.php” file into the “scripts” folder.


Open your index.php in your appearance editor or using your chosen file editor. The following code should be inserted somewhere around

if ($images = get_children(array(
‘post_type’ => ‘attachment’,
‘numberposts’ => 1,
‘post_status’ => null,
‘post_parent’ => $post->ID,)))

foreach($images as $image) {
$attachment=wp_get_attachment_image_src($image->ID, $size);
?><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><img src="<?php bloginfo(‘template_directory’); ?>/scripts/timthumb.php?src=<?php echo $attachment[0]; ?>" alt="<?php the_title(); ?>" /></a>
<?php } else { ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><img src="<?php bloginfo(‘template_directory’); ?>/scripts/preview.jpg" alt=""/></a>
<?php } ?>

This code won’t need to be altered, it basically calls the thumbnail image it has generated, adds alt tags and you will also notice the inclusion of a line containing “preview.jpg,” this is a fall back image just in case you opt to write a post with no images, so create an image the same size as your timthumb settings and upload it to your “scripts” folder.


That’s basically all you need to do to implement the script, to test this write a test post and upload an image into the post then publish, it should appear on the blogs main page (index.php.)


Timthumb generally works with most apache server setups, but in a few cases it may not. A number of hosts especially with shared hosting will need to alter some settings for you, I find the following resolves the problem, simply ask your host to:

Add following rules [ 1234234,340151 ] to mod_security for www.YOURSITENAME.com, and request the domain to be white listed.

If that fails to work, speak with your host about the error message you have received and they should be able to work out a solution.

PHP is one of the famous languages these days and people are constantly finding ways to make it easier to use, the certifications such as the 000-977 have been designed from the same prespective, however the points is how to make sure that you clear the certification without any problem, well the best answer is the 642-642 dumps, these dumps help you to clear the certifications in an easy manner, the only thing that you have to do is apply for the 642-415 certification and get the dumps before the examination.