We have included TimThumb (thumb.php) in all our themes, which is an open source image resizer. In our support forums, we often find that many problems relate to thumb.php. To help you with these common problems, we’ve put together a troubleshooting guide to help you find a solution quicker. We will try to add solutions to the most common problems here as they appear in the forum.
Finding the problem
Are your thumbnails not showing up? If the image resizer doesn’t work it will just show the post title instead of the image where the image was supposed to be. If you are using a theme with a javascript slider (Gazette) you will not see this, but only the slider trying to load an image.
First thing you should check is the thumbnail URL. It will normally tell you what’s wrong quite easily. Here are a few ways to find the URL to your thumbnail:
- Right-click on your image and open/view it in a new browser tab
- Do a view source on your website and look in your source code for the image URL (search for thumb.php) and paste it into your address bar. This is useful on themes
- Install FireBug and, right-click on the image and select “Inspect Element”. You will then get a window below which will show the source code and you can copy the image url (just click on the http:// part and it will become selected so you can copy)
Once you have the image URL it should look something like this (click this link to see the image being resized)
If your image does not show, you will probably get any of these errors explained below:
Cache Folder
One of the most common errors is that the cache/ folder does not have write permissions. If your error message is something along the lines of “Permission denied…” and you can see it referencing you /cache folder, then you probably have not set write permissions to it.
To do this, you will need to “CHMOD” the folder in your FTP client to 777 (or 755 or full write permissions). Check out this tutorial on how to do that. The folder you will need to change the permissions is “/wp-content/themes/yourthemename/cache”. This is the folder where the thumbnail generator stores cached images.
Path Problems
One of the main other problems that can occur with the thumbnail script is to do with the document root. Since there are numerous different web hosts out there that all use different web servers and settings, you might find that you will have to manually change your thumb.php to accomodate for this.
If your script is showing a message similar to “/var/www//wp-content/uploads/2008/10/featured.jpg not found.”, then this is your problem. The fix is to find the correct path to your root folder and update the “thumb.php” located in your theme folder.
First, you’ll need to take a look at the test.php file on your server. This is included in the themes and you can find it in your theme folder under “/includes/test.php” for example http://www.woothemes.com/demo/freshnews/wp-content/themes/freshnews/includes/test.php
The best way to find your path is to search for test.php, like on our demo test.php we find this:
SCRIPT_FILENAME /home/wootheme/public_html/demo/freshnews/wp-content/themes/freshnews/includes/test.php
We then know that the script path is “/home/wootheme/public_html/” because our url is “http://www.woothemes.com/demo/freshnews/wp-content/themes/freshnews/includes/test.php” and the “/demo/freshnews/wp-content/themes/freshnews/includes/test.php” is our web path.
Now we need to update “thumb.php” to set the path. Edit thumb.php and change line 54 from this
$src = $_SERVER['DOCUMENT_ROOT'] . ‘/’ . $src;
to this (we use our demo script path here)
$src = '/home/wootheme/public_html/' . $src;
PHP GD Library
The thumb.php script uses PHP GD Library to resize the images, which is usually included with PHP and should be installed on your web host. Some small web hosts haven’t done this and you will then get a error like “GD Library Error: imagecreatetruecolor does not exist”. You should ask your web host to activate PHP GD or find a better hosting provider, since this should be included and is not a hassle to setup for them.
There are also some older versions of PHP that will give an error like “gd-png: fatal libpng error: zlib error”. This should also be fixed by your host by upgrading to a newer version. This usually only happens with PNG images, so you can try to upload your images in JPEG format instead.
Still having problems?
If you still can’t get your thumb.php to work, then drop us a line in the forums, where one of our ninjas will be happy to help you resolve the problems. Please don’t post your problems in the comments underneath, but feel free to suggest improvements.
Loading...
Be First To Comment
Related Post
Leave Your Comments Below