Shopping Cart (0)

TimThumb not displaying images? Let’s fix that!

44 Posted January 9, 2012 by Guru Frog Categories: Tips and Tricks

If you’ve noticed that a number of images aren’t displaying correctly on your WordPress site, there’s a good chance that this has to do with the TimThumb script not working correctly. TimThumb is an image resizing script, often used for featured images and thumbnails. The problem is not isolated to eFrog Themes, but is widespread across a lot of themes that use TimThumb as an image resizing mechanism.

The good news is, we’ve found a fix for this, and the best part is, it’s just a simple, two step process:

  1. The first thing you need to do is ensure that your site is using the latest version of TimThumb. The easiest way to do this is to log into the WordPress dashboard, click on Appearance in the left pane, and then select timthumb.php in the right pane from the list of files. The contents of this file will appear in the center editing area. You’ll need to replace everything (yes, everything) with the code located on this page: http://timthumb.googlecode.com/svn/trunk/timthumb.php – You can do this by copy-pasta – don’t forget to save when you are done.
  2. Now, that might resolve the problem, but if not, you will need to complete this next step, which is a bit more technical, and it might be best to ask your web designer or someone in the know, to do it for you. Locate the .htaccess file on your server, download a copy and open it up for editing. You will need to add the following 4 lines of code into the file, then save the file and upload/replace the version on your server:

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule&amp>

We hope that these two steps will help you to resolve your TimThumb problems!

Till next time! *does the special Guru Frog shimmy*

Comments

09/01/2012 12:48 pm
Rox

I had an issue with my gorgeous Occassions theme with featured images, and it turns out it was a TimThumb error. Followed these instructions to the letter, and now it’s all sorted!

Thanks George and Guru Frog – for a ‘techtard’ like me, I usually struggle to sort things out on my own, so always great to get step by step tips on what to do. :)

Reply
09/01/2012 12:50 pm
Guru Frog

Thank you so much for letting us know Rox, it’s always useful to know that our advice is being used successfully.

15/03/2012 3:59 pm
coenraadf

Hi there. I am working on a site for a client, built on your The Big Deal theme. When I install it on my personal demo domain, everything works fine, but when I install it on the client’s domain, at a different hosting company, I have this problem with the images.

After much debate between me and his hosting company they suggested I look at the TimThumb issue, which I have just did, step by step as per your above post, but the issue still remains.

Do you have any ideas on how to go forward? I you would need details to access the site itself, please contact me directly.

Reply
16/03/2012 10:06 am
George

Hi Coenraad…

So we’re getting a couple of these complaints, all of a sudden. Seems that the hosting companies have taken a sudden and uniform dislike to TimThumb… :(

We read the feedback from the hosting company and it was contradictory in that they say they’ve blocked the script, but you should update the script. So maybe they mean they’ve blocked older versions of the script.

Our short-term (ie NOW) advice is to download the latest TimThumb script from here: https://code.google.com/p/timthumb/

and update it in the theme folder at:
wp-content/themes/the-big-deal-1.2/functions/efrog/lib

Backup the old one first, yes?

We’ll be making some decisions about our themes and our continued use of TimThumb in the near future, and we’ll keep you posted.

Good luck!

Reply
16/03/2012 10:14 am
coenraadf

Hi George

Thanks for the reply, but replacing the timthumb.php file does not help with the issue at hand.

This is quite a big issue at this stage, so if you could maybe help with some other suggestions it would be great.

By the way, we are running The Big Deal 1.3 and not 1.2.

16/03/2012 10:25 am
George

So, your host is blocking TimThumb completely?

We’re painfully aware that it’s a big issue. Short of holding a gun to the head of your host, any solution to work around your host’s unilateral edict, is going to take significant work, so bear with us, please.

The path was an indicator of where to find the file, not an explicit statement of your version number :)

Reply
16/03/2012 10:29 am
coenraadf

It seems like they are blocking it completely yes. Will see if we can get something done on their side as well. I understand that it is not as easy simply taking timthumb out of the theme, so I will then have to look at another solution.

Thanks for the feedback, I really appreciate it.

25/07/2012 7:06 pm
Justin

Hi,
I think this issue with timthumb.php maybe over stated. I had this problem with a few of my website including this one mentioned above. But my host (bluehost) did an excellent job of helping me clear the issue behind the scene. Not only that, they mentioned that it is the issue with the permission of the plugins folders and files. Permission for file is 644 and folder is 755. Painstakingly I did that for all plugins and even the theme files and folders. Viola, the thumbnails all loaded up! Nothing to do with timthumb.php. Hopefully others can confirm. Have a great day.

Reply
25/07/2012 7:08 pm
Justin

Sorry, my site is ebooksreviewers.com

23/09/2012 4:04 pm
rumah

Great!! i use permission for file is 644 and folder is 755.
it works. a million thank

08/05/2013 3:53 pm
Silvia

Changing permissions worked for me, like Justin said! Thanks! :D

05/08/2012 12:17 pm
williams

i used pendulum theme by rascal, and bug error creating thumb.

how fix bug:

-editing last version of timthumb (thumb.php)
-find line 825
- comment this code: $docRoot = @$_SERVER['DOCUMENT_ROOT'];

Reply
04/10/2012 10:49 am
nilam

hey williams

below code is worked for me… thank you soooo muchh.

- comment this code: $docRoot = @$_SERVER['DOCUMENT_ROOT'];

28/08/2012 8:08 am
Irwan

It’s works!! really really thank you for your help..

Reply
28/08/2012 10:51 am
George

Our pleasure. Irwan. Glad to help :)

Reply
28/08/2012 11:03 pm
Piraatti Saku

What if there are several .htaccess files? Which is the one giving trouble to TimThumb?

running “locate .htaccess” gives me
/opt/bitnami/apps/phpmyadmin/htdocs/libraries/.htaccess
/opt/bitnami/apps/phpmyadmin/htdocs/setup/frames/.htaccess
/opt/bitnami/apps/phpmyadmin/htdocs/setup/lib/.htaccess
/opt/bitnami/apps/wordpress/htdocs/.htaccess

Reply
28/08/2012 11:08 pm
Piraatti Saku

Nevermind, it’s pretty obvious with a little bit of staring.

29/08/2012 9:39 am
George

Haha! Yes. Well done :)

12/12/2012 10:51 am
admin

I stared for 2 hours, nothing jumps out. I should just change them all ?

12/12/2012 2:37 pm
George

The last one…. :)

29/08/2012 10:56 am
Piraatti Saku

Btw, for me it indeed seems to be an htaccess problem, but unfortunately I’m not able to solve it. Making everything less and less secure I’ve come to a point where timthumb works when I give it the src= as a static IP but not with a DNS name… Do you think I’m close to solving the problem? :)

Working link: http://ec2-54-247-149-100.eu-west-1.compute.amazonaws.com/wordpress/wp-content/themes/bizchoco/thumb.php?src=http://54.247.149.100/wordpress/wp-content/uploads/2012/08/screenshot_mapitakysely.png&h=366&w=960&q=100

Not working http://ec2-54-247-149-100.eu-west-1.compute.amazonaws.com/wordpress/wp-content/themes/bizchoco/thumb.php?src=http://ec2-54-247-149-100.eu-west-1.compute.amazonaws.com/wordpress/wp-content/uploads/2012/08/screenshot_mapitakysely.png&h=366&w=960&q=100

Reply
29/08/2012 2:50 pm
Saku

The problem was solved by changing the media file url in the WordPress settings to the one used internally by Amazon EC2.

17/09/2012 11:34 am
George

Yeah. Those EC2 installs can be a bit jiggy. Great servers, sometimes odd challenges to administer.

15/09/2012 7:35 pm
Kanchana

thanks a lot for info…..$docRoot = @$_SERVER['DOCUMENT_ROOT']; works

Reply
19/09/2012 5:51 am
sophia novita

Hey, it works! Thanks much :)

Reply
20/09/2012 11:56 am
Ayoub

hi man , does not work for me but this one did it .
i added my own url
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’,
);
}
highly recommend NOT doing it but it work to
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);

Reply
20/09/2012 2:10 pm
George

Wow. That last line. Bet you can’t get insurance to cover THAT! :)

30/09/2012 2:41 am
Katie

YAY!!!! My images are now showing on my site! I changed all files to 644 and folders to 755 (had already updated timthumb) and now everything is working! Even the fonts I had originally chosen are now showing :) thanks all.

Reply
17/10/2012 9:58 pm
lowestofthekeys

Great post! Though as it turned out, I was looking in the wrong direction when it came why my images were not showing up in internet explorer or firefox.

Just in case anyone has a problem similar to my own, if you are running the WP better Security plugin with WordPress, uncheck the filter suspicious query string option and that should fix it.

Reply
01/11/2012 7:55 pm
goutham

I am having problem with display of thumbnails.
when i copy the image url it is showing as below

myblogie.com/wp-content/themes/respo/js/timthumb.php?src=&w=200&h=150

could any one help with me.

Reply
08/11/2012 10:14 am
George

There’s no image specified in that URL, Goutham. (src=)
You haven’t specified how/what/where you’re having the problem, so all we can say, is the calling URL is malformed.

11/12/2012 2:04 pm
kevin

i am using photoria theme.
Problem is that thumbnail images show only some part of my original picture instead of showing the original image as small.
I read in internet that— No cropping will occur and it will adjust automatically to fit the container size if if we set –zc = 0: Resize to Fit specified dimensions (no cropping)– like timthumb.php?src=atlantis-dock.jpg&zc=0—

But i don’t know how to implement it in TimTHumb.php.
Kindly help me….

Reply
12/12/2012 2:10 pm
kevin

I managed to do it myself.
there was a file mytheme_recent_posts.php and in that file there was a code—

<img src="/scripts/timthumb.php?src=&h=250&w=300&zc=0″ width=”300″ height=”250″ alt=”<?php the_title(); ?—

And i changed zc=0 to zc-1 as i required.
Thank You

16/01/2013 10:35 pm
Yasir Imran

kevin, thank you very much for this solution. It solved my BIG PROBLEM. I also changed 1 to 0 and got the desired result.

Thanks a lot.

12/12/2012 10:24 am
admin

Timthumb doesn;t work for me
Development host is
XAMP, running on WIndows 7

Before I change
if(! defined(‘ALLOW_ALL_EXTERNAL_SITES’) ) define (‘ALLOW_ALL_EXTERNAL_SITES’, TRUE);

I think I will understand what exactly it means, and why it should fix the problem.

Reply
12/12/2012 2:35 pm
George

What Ayoub was doing was:

1. First set create an array of the external sites which ARE allowed. (Positive control over where the images come from)
2. Second (and correctly NOT recommended) he showed how to change the failsafe line “if allowallsites is NOT defined, then define it as FALSE” to a potentially dangerous “if allowallsites is NOT defined, then define it as TRUE”, so NO control on where the images could come from.

Hope that clears it up :)

03/01/2013 7:23 pm
Ken

Sweet, thanks for the fix! GREAT!!!

Reply
08/01/2013 12:35 pm
Julidas

I get this error : [08-Jan-2013 10:29:41 UTC] PHP Warning: file_exists(): open_basedir restriction in effect. File(/home2/rajulida/public_html/PROVA/wp-content/themes/Pluto/timthumb.php/PROVA/wp-content/uploads/2013/01/WM33_thumb.jpg) is not within the allowed path(s): (/home2/rajulida/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home2/rajulida/public_html/PROVA/wp-content/themes/Pluto/timthumb.php on line 859

My themes is Pluto ( from themeforest ) I try :
1. Htaccess change
2. Permission change.

If any have some idea to help me thanks !!!

Jul

Reply
06/02/2013 12:59 pm
amaz

you are the man you made my day it worked like charm…thanks man awesome..

Reply
17/02/2013 3:56 pm
Steven Hibbs

You are my hero!!!! Thank you!!!

Reply
06/03/2013 6:47 pm
Kamran

I’ve WP Better Security installed on my site may be this is causing the problem. Well, I’m using Elegantica Theme, it works fine on my localhost but on the WebHost it is not displaying images. I changed timthumb.php code from the URL mentioned above, changed file permissions etc but nothing happened. Any help ????

Reply
15/03/2013 11:00 am
George

You should probably have a word with support at your hosting company. Maybe they’re just blocking TimThumb completely?

01/04/2013 11:53 pm
Jillian

Hey,

I’m having issues with the thumbnails not showing on any pictures that are bigger than 1500px. Works great with any other images that are smaller, thumbnails show. How can I fix this issue? Anyone else have this issue.

Reply
08/04/2013 1:23 pm
hamid

These solutions don’t work for me . Timthumb worked good in my site since today . I’ve tried all the solutions here but the problem still exists.

Reply

Leave a Comment

(required)

(required, not shown)

TimThumb not displaying images? Let’s fix that!

If you've noticed that a number of images aren't displaying correctly ... Read more

George has something new to show you

Hello tadpoles! We're as happy and excited as a dog with two tails, to tell you about the latest theme from the team around the pond. It's called Cohesion, and we like to think of it as "a socially-engaged business theme". Read more

Colour palette basics – Analogous and Monochromatic Colour Schemes

Some people may have a natural knack for knowing and understanding wha... Read more

Valentines Giveaway: Win a copy of our new gorgeous theme – Occasions

Love is in the air, and lucky for you frogs aren't immune to Cupid's m... Read more

Adding a Tweet Box to your site

Both Windows and Mac are integrating social media platforms more and m... Read more

eFrog News Categories

Browse our themes