You may not fetch images from that site. To enable this site in timthumb, you can either add it to $ALLOWED_SITES and set ALLOW_EXTERNAL=true. Or you can set ALLOW_ALL_EXTERNAL_SITES=true, depending on your security needs.
You might have seen an error message very similar to this lately, or perhaps you noticed that your thumbnails are no longer working. You might be asking yourself “what is this error and how do I fix my website”, if so — we’re here to help!
What is timthumb?
Prior to a few months ago, nobody really knew what timthumb.php was. This was until someone found an exploit in it’s code and started hacking WordPress blogs left and right. If you’re still not sure with timthumb.php is, it gets bundled with a lot of WordPress themes and is usually designed to create thumbnails of larger pictures for your blog, most people have it without even noticing.
So, what do we do?
You need to make sure a few things are up to date, they are; wordpress, all themes and all plugins. In most instances, the wordpress theme makers are now bundling the correct timthumb.php which will protect you against the exploit that came out. Keeping in mind that if you were hacked prior to upgrading timthumb.php, you will still be hacked, it doesn’t repair a hacked installation of WordPress.
So, we’re all good than, right?
For the most part, yes! However, the way a lot of people generate thumbnails is by using the full domain name in the URL, such as http://example.com/wp-content/themes/phones/timthumb.php?src=http://example.com/wp-content/uploads/2012/02/skype-windows-phone.jpg&h=60&w=60&zc=1. The correct way to use timthumb is to link to the directory only, such as http://example.com/wp-content/themes/phones/timthumb.php?src=/wp-content/uploads/2012/02/skype-windows-phone.jpg&h=60&w=60&zc=1.
But, I have all of my thumbnail links already generated and it’s too much work to change them all!
We can understand that, if you don’t feel like changing all of your WordPress links to the new format (the non-domain format), you can add your domain as an “allowed domain”. We warn you though, if you’re not experienced in web design, it may require a little work on your side.
Step 1) Go to your website which would show a thumbnail (the main page, in most cases) and click “View Source”
Step 2) You will need to search that page for a <img src> tag which is calling timthumb.php, it will look similar to: <img src=”http://example.com/wp-content/themes/phones/timthumb.php?src=http://example.com/wp-content/uploads/2012/03/ics-update.jpg&h=300&w=460&zc=1″ alt=”"/>. This is the path to your timthumb.php file which you will need to manually edit.
Step 3) Fire up your FTP client and download that file. In our example, it’s going to be in /home/user/public_html/wp-content/themes/phones/timthumb.php.
Step 4) Edit that file carefully and look for the line that starts with “$ALLOWED_SITES = array” you will see a list of sites that are allowed by default.
Step 5) You will want to edit that file to add your domain to it, in our example we’re using example.com as our domain, so our ALLOWED_SITES variable should look like this when we’re done:
if(! isset($ALLOWED_SITES)){
$ALLOWED_SITES = array (
'flickr.com',
'staticflickr.com',
'picasa.com',
'img.youtube.com',
'upload.wikimedia.org',
'photobucket.com',
'imgur.com',
'imageshack.us',
'tinypic.com',
'example.com',
);
}
Step 6) Save that file and re-upload it to the same directory, in our case it was /home/user/public_html/wp-content/themes/phones/
But…. I use thumbnails from hundreds of domains, I don’t want to add each one!
While timthumb.php allows you to turn off this security check, we highly recommend NOT doing it. If you link to multiple external URLs and don’t want to add each one to $ALLOWED_SITES, you can disable the security check by editing timthumb.php and replacing this line:
if(! defined('ALLOW_ALL_EXTERNAL_SITES') ) define ('ALLOW_ALL_EXTERNAL_SITES', FALSE);
with:
if(! defined('ALLOW_ALL_EXTERNAL_SITES') ) define ('ALLOW_ALL_EXTERNAL_SITES', TRUE);




