Skip to content

TimThumb Beta Test

tim-thumb-2A couple of weeks ago I posted a brief history of TimThumb, the image resizing script I am responsible for. I said in the conclusion that I was looking for beta testers, and I am, however I have been a bit slack at sending out the script to the people who ask.

So, I thought I would upload it for everyone to download so that we can give it to a wider audience.

The previous TimThumb beta is now very out of date. Please make sure you use the latest version of the script to get all of the features listed above, and more.

Installation

Firstly I would recommend renaming your existing TimThumb script incase something goes horribly wrong. Then download the file linked above and put it in the same location as your current version. So far so normal (although do note I added an ‘s’ to the file extension so be sure to rename to ‘.php’).

After this you will need to create a new folder in the same directory as the cache folder. Currently I am not sure if this will remain or if I should use the cache folder or if I should do something totally different – feedback on this would be welcome. You should name the new folder “temp” and give it folder permissions 777.

What to test?

The main thing I want tested is the offsite image resizing. Currently only flickr.com, picasa.com, blogger.com, and wordpress.com are supported (and I have only tested Flickr myself) but these settings will be configurable in the future.

Feedback

Any and all feedback you can give would be most welcome. Simply post your thoughts in the comments below – and thanks a lot for being so willing to give you time to help improve TimThumb.

Categories

TimThumb, Web Design

Ben View All

Ben is a lifelong Nintendo fan who also likes to build websites, and develop games. He also buys way too much Lego.

138 thoughts on “TimThumb Beta Test Leave a comment

  1. Just to post an update – this isn’t working for me yet… I usually link to the absolute path in wordpress, so it is blocked by default. Even after adding it to the allowed sites, it still won’t work.

    I get this:

    Unable to open image : /home/users/mysite/htdocs/wpmu/wp-content/themes/mytheme//temp/imagename.jpg

    Notice the two slashes before temp.

    When I go to the temp folder and open the image that has been generated, it is an empty jpg file.

    I’m using wordpress mu, so that might have something to do with it.

    I do have the original timthumb script working though.

  2. Hi Bobby – as mentioned the limit to those sites is currently for testing and will be configurable. The actual reason for the limit is security. If I allowed all sites then potentially harmful things could be loaded (no idea what but I am sure someone could work something out) so I added the restrictions to try and protect people.

    Not sure about your other issue though – could you give me a link to the image you are trying to embed?

  3. Thanks Ben! Its working like a charm for me. I made a change to the array to allow images from a couple of my affiliate sites and Amazon.com and everything works perfectly.

  4. Thanks Ben. Unfortunately I can’t give out the link as it is on a private server, but I am going to try looking into it a bit more today. I’ll let you know if I find out anything else. I really appreciate the work you put into this!

  5. Hi Kuschti – I have made some small changes to TimThumb and you can get the latest version from the same download link as before.

    Also I would suggest altering the code that adds the image url so that it encodes the url (eg urlencode($imagePath))

    Bobby – it might be worth you trying the new version as well

  6. It doesn’t do anything for me to: I get a blanc/white page when overwriting the old timbthumb.php with the BETA one.

    Also empty the array or adding my own/same domain has no effect at all.
    So I’m not eveen talking about the cross-domain feature, yet…

    Any suggestions?

    • Tschai – without being shown a sample link I can’t really comment. I need to see the problem to be able to fix it

  7. Ben, here are the 2 examples:

    The original script:
    http://gunlukfutbol.com/wp-content/themes/magazeen/timthumb.php?src=http://gunlukfutbol.com/wp-content/uploads/2009/07/vp_blog_test.jpg&h=246&w=521&zc=1

    And the BETA one:
    http://gunlukfutbol.com/wp-content/themes/magazeen/timthumb_BETA.php?src=http://gunlukfutbol.com/wp-content/uploads/2009/07/vp_blog_test.jpg&h=246&w=521&zc=1

    The old/original timbthumb resizes it just fine, the beta does nothing for me.
    I’ve got the temp folder chmod/777, but no cache-file is generated.

    If I use image from a domain not enlisted in the array, I get the appropiate warning. So the script is running ‘fine’…

    • Hmm – that does indeed look strange. Would you mind giving me ftp info so I can take a look at it properly? If you don’t mind then you can send me the details through the contact form on my about page.

  8. Hmmm…
    Doing the same on my localhost did work out great!

    So it has something to do with my server, I guess?

  9. Another thing; if I put manually the resized file in the cache/temp folder it dows show that, like it’s working…

    So it looks like the script has troubles writing in my temp folder, although it’s 777-ed and the original script has no isseus.
    I’ve tried the same on anothe site of mine with the same result though. It’s at the same host, so…

    • Hi Tschai – I have your email with your ftp details. I am going to look into this tonight. Thanks for sending it over

  10. Hi Tschai – looks like it is working now and I have updated the beta file to the latest version as well

  11. Pingback: Stopping html encoding in URLs - WordPress Tavern Forum
  12. some trouble here . All worked but this morning, all are generated on 1024 by 768 . But i set the &w=100&h=100 … so i don’t understand why …

  13. I managed to make a workaround on the problem on wordpress mu. Not quite good but at least it works!
    1. I placed timthumb in a folder from the root. i.e, mydomain.com/thumb
    2. placed timthumb.php in that folder
    3. Created two subfolders named cache and temp and set it to 777
    4. modify all instances of the timthumb in the template files as below

    /thumb/timthumb.php?w=150&h=200&zc=1&src=

    As I have said, it’s not ideal but until we find a better way, I’ll stick into this.

  14. ooops… the codes did not appear correct.
    please delete this comment if it still does not appear.

    <?php bloginfo('url') ?&gt/thumb/timthumb.php?w=150&h=200&zc=1&src=<?php echo $thumb; ?&gt

    • I am afraid I have never used rewrite rules to create the images so I don’t know how this would work or why you are seeing the behaviour you are.

      • That is not my site. Just trying to make sure it won’t mess up if some user uses an image from a site using rewrite rules. It just needs some way of checking if the thumb created is valid or simply get the image from the proper address. I’ve seen it happen from other sites too.

        Here is the error from the script.

        http://pastebin.com/m6bdbb6ca

        And this is the content of wp-content/temp/3322a-Alicia_Marie.jpg

        http://pastebin.com/m6dfeef7b

  15. Pingback: Thumbs script failing for images hosted externally - DIYthemes Forums
  16. hey, great code – always use it… so glad remoteing is built in, thanks! Found one minor issue in the CURL stuff:

    curl_setopt($ch, CURLOPT_HEADER, 1);

    always threw an “unable to open” error on the file…. not exactly sure why, but when i pulled the file into the browser, it displayed the filename in the browser… really strange… the file was written to the temp folder on the file system and the correct size… just got it’s type mixed up i guess in the file header….

    anyway, commented that line out and it works great.

    thanks!

    • That’s interesting to know – I will try that out and see if it helps on some other sites I’ve had problems getting this to work with. Thanks for the pointer.

  17. I really wish you would set something up to be able to disable your Timbthumb script, because almost every premium theme uses timbthumb, and my sites usually use an external server for images, I have searched everywhere for a way to disable it, and i cant find a way. i do not like having to create a custom theme every time i build a new word press site.

    i installed the beta and i can not get it to work, am i suppose to put the full url including http:// in to the custom field ?

    • Hi – I’m sorry you don’t like TimThumb. Unfortunately it’s not up to me to give people a way to disable TimThumb. The script does one thing and one thing only, it resizes images. It’s down to the theme authors to offer a method for not using images and doing the resizing.

      Regarding your question, you do indeed need the full url, including http:// – if you do not use this the image will never load. You also need to make sure that you have added a temp folder with permissions set to 777 in the same directory as TimThumb, and you need to make sure the external server supports access from other sites (not all do)

  18. Pingback: Timthumb workaround - WPMU Tutorials
  19. Hi Ben, I love the script. There is just one thing I can’t figure out. To simply resize the image proportional… (max-width an height) When I set the zc to 0 it still crops the image it seems. Maybe it’s been asked before, but I can’t seem to figure it out. greetings, Pr

    • To resize proportionally you should simply omit the dimension you want to remain dynamic, so if you want the width to be 100px you set w=100 and ignore h

  20. It’s not that i do not like timtumb, it is that i use external images for most of my sites, so i cant use most of the pro themes on the internet because they all use TH

    I set up everything just like you said, and used a image from one of the recommended sites, it still does not work.

    i put the http://

    And i set up the temp folder with permission 777 as well

    • Do you have a website where I can have a look? Perhaps you could send me ftp details via the contact form so that I could do some testing?

      I should point out that not all sites will work with external linkage, purely because some hosts disable the features required, and some developers set the wrong permissipns on the files.

  21. Pingback: From splitting headaches to splitting blogs
  22. Thanks so much Ben for breathing new life into Timthumb. Will this new release work with WMPU? If so, I’m happy to test it out on our site — would love to provide a premium theme to some of our bloggers that can all share the thumb.php. Currently, I’m using a hack to point for the root, which, of course, limits the ability to share the theme with other subblogs.

    Thanks.

    Marty

    • Hi – TimThumb already works with WPMU, the problem is that themes link to TimThumb in the wrong way so the images will not be scaled. I am currently testing the code that makes the site works with WPMU (which requires some theme modifications) and will be posting the suggested fix as soon as I am sure it is solid (in the next week or two I think).

  23. Hello. I’m preparing on my localhost (on MacOSX Snow Leopard, incl GD support!) a new version of my blog. Therefor I used a theme with TimThumb.

    Well… The images wont appear. In a way it returns with:

    http://localhost/~rene/blog/wp-content/themes/mimbo/scripts/timthumb.php?zc=1&w=260&h=230&src=/~rene/blog/wp-content/uploads/DSC_1969-300x198.jpg

    the error

    file not found ~rene/blog/wp-content/uploads/DSC_1969-300x198.jpg

    —-
    When I put

    http://localhost/~rene/blog/wp-content/uploads/DSC_1969-300x198.jpg

    in the address bar, it returns the image.

  24. Hi Ben – I was about to tell all the users on my WPMU site not to use external images, so this was a relief to find!

    However, one problem: Images from Blogger blogs give the error “local file … can not be created.” I’d already added “blogspot.com” to $allowedSites at Line 551, since images from individual Blogger blogs use “blogspot.com” domains. I even tried allowing the subdomain of one particular image, “2.bp.blogspot.com”, but got the same exact error.

    I assume the “can’t create local file” problem is with Blogger, not timthumb, but I wanted to ask any advice you may have. Maybe blogspot.com just won’t allow timthumb access… Hope not.

    I’ll keep checking this page — I’m looking forward to configuring timthumb to allow ALL external images soon! (I trust my users, so it seems low-risk to me.)

    Thanks,
    – Jack

    (P.S. Besides external images, timthumb worked perfectly in Arras Theme with WPMU, OOTB! I also made some theme mod’s so if the user doesn’t enter the custom thumb field, the first image of a post becomes the thumb and is resized by timthumb. If folks are struggling with that sort of thing, I can share the mod.)

    • Hey Jack, Did you create a “temp” directory in the same directory as TimThumb and give it 777 permissions?

      Unfortunately it seems some sites don’t simply don’t allow externally grabbing the images, so it will not be possible on all hosts, but I have a feeling I’ve used it on blogspot myself (but don’t remember for sure 🙁 ).

      • @nick: in template.php, i changed the function arras_get_avatar as follows. it’s sloppy code because it was just intended for my site, and also i added a bunch of options to Arras’ theme options, so you can ignore that stuff:

        function arras_get_thumbnail($w = 630, $h = 250) {
        global $post;
        $thumbnail = get_post_meta($post->ID, ARRAS_POST_THUMBNAIL, true);

        if (!$thumbnail) {
        // return false;
        // Instead of returning FALSE, if there's no thumbnail we'll look for the first image in the post
        // ... and if there's no image in the post, we'll use a default image, so there will always be a graphic.
        global $post, $posts;
        $first_img = '';
        ob_start();
        ob_end_clean();

        $output = preg_match_all('//i', $post->post_content, $matches);
        $first_img = $matches [1] [0];

        if (empty($first_img) || !strpos($first_img, 'usas.org') ) { // If there's no image in the post, (or if the first is external image) let's use a default image.

        $blog_default_thumb = arras_get_option(blog_default_thumb);
        if ( !empty($blog_default_thumb) ) { // Checks whether this particular blog has its own default image
        // $blog_default_thumb = arras_get_option(blog_default_thumb);
        // Should we check for & replace short form URLs? (omitting /blog.dir/, for example)
        global $blog_id;
        // Remove the extra text Arras adds to the end of the image file name (i.e., '-150x150')
        $first_img_long = preg_replace('/-[0-9]+x[0-9]+\./', '.', $blog_default_thumb);
        // Use the real URL instead of the shortened one: /files/ becomes /wp-content/blogs.dir/1/files/ where '1' is the blog ID#
        $first_img_corrected_start = strpos($first_img_long, 'files');
        $first_img_corrected = substr_replace($first_img_long, 'wp-content/blogs.dir/' . $blog_id . '/files', $first_img_corrected_start, 5);
        //$first_img_corrected = $blog_default_thumb;
        }

        else { // If the blog doesn't have one, we'll use this sitewide default image:
        $first_img_corrected = get_bloginfo('template_directory') . '/images/USAS_logo_white_on_blackPNG.png';
        }
        }
        else {
        // If the image is located internally (on this blog's USAS.org directory)...
        if (strpos($first_img, 'usas.org'))
        {
        global $blog_id;
        // Remove the extra text Arras adds to the end of the image file name (i.e., '-150x150')
        $first_img_long = preg_replace('/-[0-9]+x[0-9]+\./', '.', $first_img);
        // Use the real URL instead of the shortened one: /files/ becomes /wp-content/blogs.dir/1/files/ where '1' is the blog ID#
        $first_img_corrected_start = strpos($first_img_long, 'files');
        $first_img_corrected = substr_replace($first_img_long, 'wp-content/blogs.dir/' . $blog_id . '/files', $first_img_corrected_start, 5);
        }

        /*
        NOTE: For now I'm disabling external links completely because timthumb.php (image resizer) can't handle them.
        To re-enable external images, lose the commenting marks here, AND the or statement ("||...") near line 231.

        else // If the image is located externally (on some other site, NOT this blog's USAS.org directory)...
        {
        // No need to correct anything about an external URL
        $first_img_corrected = $first_img;
        }
        */
        }
        // Now, enter whatever image URL we got into timthumb for a nice pretty resized version!
        return get_bloginfo('template_directory') . '/library/timthumb.php?src=' . $first_img_corrected . '&w=' . $w . '&h=' . $h . '&zc=1';
        }

        else {
        if (ARRAS_THUMB == 'phpthumb') {
        return get_bloginfo('template_directory') . '/library/phpthumb/phpThumb.php?src=' . $thumbnail . '&w=' . $w . '&h=' . $h . '&zc=1';
        } else {
        // Remove the extra text Arras adds to the end of the image file name (i.e., '-150x150')
        $thumbnail_long = preg_replace('/-[0-9]+x[0-9]+\./', '.', $thumbnail);
        // Use the real URL instead of the shortened one: /files/ becomes /wp-content/blogs.dir/1/files/ where '1' is the blog ID#
        $thumbnail_corrected_start = strpos($thumbnail_long, 'files');
        global $blog_id;
        $thumbnail_corrected = substr_replace($thumbnail_long, 'wp-content/blogs.dir/' . $blog_id . '/files', $thumbnail_corrected_start, 5);
        return get_bloginfo('template_directory') . '/library/timthumb.php?src=' . $thumbnail_corrected . '&w=' . $w . '&h=' . $h . '&zc=1';
        }
        }
        }

  25. Hello –

    Thanks a lot for picking up development of TimThumb and making these much needed additions! I’m trying to get the script to work on external images with no luck so far. I added some new allowed domains and placed the timthumb.php file in a directory under my wordpress theme directory, the created the temp dir with 777 permissions. The image files get created in the temp directory but when I have downloaded and opened them they just say “Invalid Image”. If I try to load the file directly in the browser using the full URL with timthumb.php and src=*external url* I get the following errors:

    Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /home/blog_path/wp-content/themes/jungleland/scripts/timthumb.php on line 308

    Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: ‘/home/blog_path/wp-content/themes/jungleland/scripts/temp/image_filename.jpg’ is not a valid JPEG file in /home/blog_path/wp-content/themes/jungleland/scripts/timthumb.php on line 308
    Unable to open image : /home/blog_path/wp-content/themes/jungleland/scripts/temp/image_filename.jpg

    As I was writing this, I tried some other feeds and it turns out that some work and some do not… For instance:

    blogspot.com images seem to work
    farm4.static.flickr.com images not working
    images at another dreamhost.com domain I am hosting are not working
    images hosted at coxnewsweb.com are working

    Please let me know if you have any ideas. Also, feel free to contact me directly at my email and I’d be happy to try to help you test this stuff out as it is very important to my project.

    Thanks again!

  26. Hey there,

    very nice script, I’m using it since three years and many many websites 🙂

    Today I encountered a problem while handling a subdomain so I downloaded your beta version – but it still doesn’t work for me.

    I’m using WordPress and a short url (www.fdp.li). I created a subdomain (http://img1.fdp.li) which links to my images-folder (http://www.fdp.li/wp-content/themes/fdp-bornheim/images/) and here comes the problem: If I try to resize the image while using the subdomain I get a blank page – see here. When giving TimThumb the long-url, everythink is working fine – see here!

    Do you have any idea that couses this problem?

    Greetings from Germany,
    Oliver

    P.S.: The old TimThumb-version doesn’t show a blank page like the actual beta but “file not found img1./mitglieder/freynick.jpg” – perhaps this might help to find the error.

  27. Argh, I just deleted “img1.fdp.li” from the “allowedSites”-array and got “remote file not allowed …”. So is it the server causing this problem?

  28. And number 3 🙂

    I just saw the new version uses “fopen” and “allow_url_fopen” isn’t enabled on my server (but curl does work!) :-/

    Is there any way to bypass the use of “fopen” and instead use curl? Alternatively would it be possible do disable all the “allowedSites”-stuff und just allow every domain?

    Greets,
    Olli

  29. And me again (and hopefully a last time) 🙂

    Now I’m getting the error “Unable to open image : ./temp/freynick.jpg” while trying to open the image via “http://www.fdp.li/wp-content/themes/fdp-bornheim/timthumb.php?src=http://img1.fdp.li/mitglieder/freynick.jpg”. The temp-folder exists and TimThumb even creates the image in the temp-folder. I don’t know where the failure is …?

  30. Also, is there a way to identify that the script has returned an error and catch it so that I can display a default image? I’m sure I can go into the timthumb.php script and hack something there but wondering if it can be done where it is being called instead.

    Thanks for your help!

    • Hi – I have default images on the todo list for TimThumb. It will be coming in a future version, but I am not sure when that will be released.

  31. Hi,

    I have WP MU set up in a sub directory of the main domain, so it is here:

    http://www.trashedmag.com/members/

    I need to be able to get the thumbnails working on both that url and ones as such:

    http://www.trashedmag.com/members/markjenkins

    I have the same problem where the /blog.dir/1/ is stripped out and it can’t find the image because it “doesn’t exist”

    I was wondering if anyone could give me some instructions on how to make the edits to the timthumb.php file please?

    thanks
    Mark

  32. Hey Ben,

    Trying out your beta version of the plugin. I have the temp dir. created and chmod to 777. I have added the url of my source to the sites array. The resized picture is created in the temp directory but the value returned to the html is the value I passed into timthumb. Any ideas?

      • Ben – Thanks for you help – http://test.mannaadventure.com/ – as you will see it works great for files hosted on the same domain. When I attempt to pull in a file from a different domain it appears to create the smaller image in the temp directory, but upon browsing the file I get the error icon. It appears as if the OS / browser does not recognize the file header.

      • Hi Justus – thanks for sending me your details and sorry for not getting back to you sooner. I have finally taken a look at your server and think I have fixed the problem. The fix has been posted above, and I have implemented it on your site.

  33. Hiya,

    Thanks for the script, the updates, the support and all the time!

    I’m a noob but am having issues too; similar to one above but I don’t see the solution posted so I thought it would be wortwhile running through my issues.

    I’ve the 777 temp folder in the right place. The error I get now is:

    Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: '/users/girdwood/www.geeknative.com/wp-content/themes/myweblog/temp/dnd-elf.jpg' is not a valid JPEG file in /users/girdwood/www.geeknative.com/wp-content/themes/myweblog/thumb.php on line 308

    Warning: Cannot modify header information - headers already sent by (output started at /users/girdwood/www.geeknative.com/wp-content/themes/myweblog/thumb.php:308) in /users/girdwood/www.geeknative.com/wp-content/themes/myweblog/thumb.php on line 723
    Unable to open image : /users/girdwood/www.geeknative.com/wp-content/themes/myweblog/temp/dnd-elf.jpg

    I can see the files in the /temp folder and notice they’ve 600 permissions. I’ve changed those permissions so I can take a look at the file and rather than an image there’s just a line of text that repeats the image’s URL.

    Any help is most appreciated!

    • Not using the external hosting / turning off the S3 integration seems to work. Could this be an issue as to how I added S3 to the safe list? I added the ‘images.geeknative.com.s3.amazonaws.com’ rather than just ‘amazonaws.com’.

      I’m slightly concerned about trying the latter as it looks like sec vun to me; I can’t vouch for all amazonaws.com content… am I being paranoid?

    • Hi Andrew – I think I have fixed the bug in this. Could you try downloading the beta again (same link in the post above) and let me know if that works? I would clear out the temp and cache directories before testing else the files won’t be updated

      • Thanks!

        Good news. Works like a treat. I’ve now got S3 providing the juice for my images.

        I’m impressed by your amazingly quick turn around! Thanks again!

  34. I wondered if one could explain for someone with close to 0 knowledge of coding how exactly to configure resizing and fetching images from external sources. At least some basic steps would be great.

    • At the moment it’s not that straight forward if you’re not particularly technical (everything you need is in the post above). When I get some free time I will be tidying it up so the whole thing is a lot simpler for everyone to use.

  35. TimThumb is great. But, is there a danger that some hacker could bring down your server by creating endless cache files that fill up your server?

    Since the URL is something like:

    ../timthumb.php?src=sourceurl&h=100&w=100

    A hacker could alter the height and width and request millions of combinations, each one generating a cached file on your server. Eventually, your server could run out of space. no?

    • Hi Bill, just my opinion. I’m timthumb have built in function to let user define how many image files to store in cache and how many to to delete in each clear.

      but still i think hackers also could put heavy load on site just by requesting the image combination.

  36. Any expected date of final release of this new version? I am waiting long for feature of using images on external domains.

  37. I’m using Amazon S3 and I can’t seem to get it to work. Andrew any advice on this? Do we set it up media.healthchic.com.s3.amazonaws.com
    or amazonaws.com as allowed urls? I can’t figure out what I’m doing wrong. I’m still serving thumbnails from local page, but one of them I’m trying to serve via this external method and it isn’t working.

  38. Using 1.10b as replacement for an old version works on xampp without problems. Just need a temp folder beside your cache folder. However, I have to modify template files because the hardcoded ‘/’ before the call to the custom field doesn’t work in front of http…

    Anyway, a flickr image was placed in temp by the beta script and rezised to the given parameters into the cache folder.

    Thanks, going to setup a site online and I am sure it works there with the allowed hosts (good idea btw)

  39. did any develpment in loading external images,

    i need this option very much,

    plz add this option else u can add like this

    wen we give external image url it will get download to our server and load in theme,coz i add more than 50 videos , i have to upload all image maulaly which is quit hard,so i can just give external image so the images get download in server and load in template

    is there any option we will get in develpment,

    i am in hurry

  40. thanks ben, i reallly apperciate u r help working great, but only with the selected source, but we can add what evevr source we like ,

    i am using tinypic.com mostly

    i added like this ‘tinypic.com’,

    in this code and works great

    function checkExternal ($src) {

    $allowedSites = array(
    ‘flickr.com’,
    ‘picasa.com’,
    ‘blogger.com’,
    ‘wordpress.com’,
    ‘add any domain ur mostly used here’,
    );

    works greats thanks pal,
    $allowedsites = $img would be great

    thanks ,looking for future improvment

  41. now i had another issue, the wp postrating images also getting resized, how i can prevent wp post rating not to resized,

    thanks

  42. That’s working great already, thanks Ben!

    Putting the script online just required to set the two folders /temp and /cache to 777 and it worked.

    Sure I straight ran into the imagecreatefromjpeg error on loading an old non-existing flickr image. Here flickr supplies you with a photo_unavailable.gif. The script saves this with a jpg extension to the temp folder and is finally not able to handle this file with wrong extension.

    That’s a minor problem, just want to say it’s running fine on my vserver.

  43. Pingback: Use TimThumb Script to Generate Thumbnails on External Domain
  44. it didn’t work with picasa, because google use “ggpht.com” for the link,
    so i had manually change it to work.
    i have test it in localhost, so far so good! 😀
    thanks

  45. Hi there,

    I’m currently using a wordpress-template that makes use of the timthumb image generation. Now I want to develop an own theme and tried to get the actual design theme working on my localhost (xampp + mac). Unfortunatelly, the timthumb generated images are being generated but are not displayed.

    I changed the read/write-permissions as mentioned by several other users (777). When viewing the sourcecode, I call the generated image like this:

    For testing, I copy&paste the src-command and called the src itself. As a result, I get the following error-messages, I can’t handle myself:


    Deprecated: Function split() is deprecated in /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php on line 320

    Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php:320) in /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php on line 300

    Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php:320) in /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php on line 301

    Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php:320) in /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php on line 302

    Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php:320) in /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php on line 303

    Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php:320) in /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php on line 304

    Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php:320) in /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php on line 305

    Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php:320) in /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/arthemia-premium/scripts/timthumb.php on line 306
    ÿØÿà?JFIF??????ÿþ?;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 80 ÿÛ?C? [...]

    Can you just tell me, how I can get the timthumb-script work on localhost?

    Greetings,
    Timm

    • @Timm
      This error Function split() is deprecated you get in newer versions of php (5.3?)
      However, this function split() you find only in older versions of the timthumb script.
      With the special version you find here, you should not have this problem as there is no ‘split’ in the code.
      AND, do not forget the the offsite image resizing in this modified timthumb here – I like it, thank you Ben

  46. Pingback: Create Thumbnail From Offsite Image Using Timthumb Beta
  47. For anyone who is subscribed to this post… I have now commited the beta version to the public copy, so this is no longer beta and is on Google code for all to use.

  48. Hi, i’m trying to upload the timthumbbeta.php version to my arras theme installation in http://www.netbookya.com, but, i see, all the archive is full of span and style tags…. why?

    it’s horrible!!! I can’t edit well the archive ¬¬.

    Someone can upload the archive more clean?

    and…

    i want to know if it’s compatible with wordpress mu, or i need to make some change like in the normal timthumb version.

    Thank you so much!

    • Hi – TimThumb isn’t going to generate html/ php errors on your template. You should talk to the theme developers about that.

      TimThumb is compatible with WordPress mu but I don’t know if Arras is, there’s info on making your theme compatible with TimThumb on this post about WordPress mu.

  49. I came here after checking and re checking file and folder permissions I even called my host provider. They confirmed my permissions were set to 777 on scripts/, cache/ I even added the temp folder. But keep getting the 500 error. Please help. I am using wordpress normal not MU. and the mimbo theme.

    all I get is the little red x or blue ? where the image should be.

    • I’m going to bet that you’ve set the scripts directory to 777 permissions as well. It shouldn’t be. Make it 644 and you’ll probably be ok

  50. Hi Ben,

    Script works very fine on local but when it goes to production an error returns such as “Access to requested resource is denied on this server”

    Do you know why that happens?

    • Hey Mehmet. This is probably to do with directory permissions. Make sure the only directories that are set to 777 are the temp and cache ones. The rest should use the normal settings (644 I think)

    • Hi Ben,
      it looks like this beta version isn’t going to resize external URLs with a space in it. I tried find/replace the space with %20 but without any results.

      http://www.mydomain.com/utils/timthumb.php?src=http://www.externaldomain.com/catalog/images/wenger%2050.jpg&h=150&w=150&zc=1&q=80

      A url like above is not working for me and results in PHP errors:

      Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /home/tandenb/domains/mydomain.com/public_html/utils/thumb.php on line 308

      Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: '/home/tandenb/domains/mydomain.com/public_html/utils/temp/wenger 50.jpg' is not a valid JPEG file in /home/tandenb/domains/mydomain.com/public_html/utils/thumb.php on line 308

      Warning: Cannot modify header information - headers already sent by (output started at /home/tandenb/domains/mydomain.com/public_html/utils/thumb.php:308) in /home/tandenb/domains/mydomain.com/public_html/utils/thumb.php on line 726
      Unable to open image : /home/tandenb/domains/mydomain.com/public_html/utils/temp/wenger 50.jpg

      Other images do work.

      Yours

      • urls shouldn’t have spaces in them, that’s bad practice. I would recommend renaming the image and trying again.

  51. I actually did that Ben. Folder structure is scripts, inside the folder scripts there is cache folder and timthumb.php

    cache folder is set to 777
    scripts folder is set to 755
    timthumb.php is set to 644 (default)

    I am trying to find the problem since 2-3 days with no luck..

    • I read between the lines: Mehmet doesn’t have a /temp folder!
      Create this behind the scripts, beside cache folder as it’s needed for the external images.

      • Joern, you… you are the man.
        I’ve been hacking away at timthumb for 5-6 hours steady… I can’t even smell right anymore.

        I had Mehmet’s identical problem, could NOT solve it until tried Ben’s version and I read your comment. /temp fixed everything.

        Thank F*** it’s finally fixed… and thank Joern! ha

        Cheers,
        Mike

  52. Pingback: 5 (Really Good) Reasons to Build Your Site With Genesis | Links to Wordpress
  53. hi there,
    thank you very much for this code.

    I have it enabled in my site,
    and I made it to resize external images from all sources.

    now I saw that I there’s no limit for the thumbs generated,
    I just made a w=20.000 & h=15.000 thumb… that’s quite scary.

    is there a way to limit that?

    cheers!

  54. can you please have a look at my side…

    obviously it doesn´t work…

    I uploaded the new timthumb.php file and tried it out with this pic http://www.tourendatenbank.com/gps/testbild/ – on the main site you can see that there is no thumbnail..

    but in the source code you can see that it is still

    can you help pls.

    thank you.

    bergblume

  55. @Ben I’m talking actually about an external/remote domain so I don’t have any control over whether there are spaces or not in the filename. 🙂

  56. Anyone had any luck getting the new version to draw and resize images from Amazon?

    – I have made sure the cache and temp folders are 777.
    – I tried adding “amazon.com” to the allowedsites array.

    Still wont pull them though.

    Anyone have any luck with it?

  57. @Mark I haven’t tried to get Amazon to work, but their images are typically hosted at images-amazon.com not amazon.com.

  58. @ Frank –

    Thanks for the update on it! I tried that one before with no luck. I think it may be on my server end, as nothing seems to be writing to the temp folder at all.

    Tried permissions of both 777 and 755 (Hostgator server) but I may need to dig deeper than just permissions on it, since its coming from an outside domain.

    Thanks again,

    Mark

  59. Pingback: 5 (Really Good) Reasons to Build Your Site With Genesis
  60. Can anybody explain to me how you get this to work as I have copied the code into my timthumb.php on wordpress and changed folder permissions on my host and still just x’s where the picture should be.

    What else do I need to do to make it work because in every post I read something else but still at a loss as to what steps I need to take next! Do I use the custom CSS in my theme or the “first image” option?

    Where is it that I put “allowed sites” as I am seeing alot of talk about that but no instructions!!!

    Do I need to further customise the actual timthumb code or should it be ready to go?

  61. I was having trouble getting this to work with external images residing on https:// addresses. I couldnt find the source of the problem but i added the following line in at the beginning of the cleanSource function

    $src = str_replace('https://', 'http://', $src);

    its more of a hack than a fix, which simply changes the checked image src to a regular http:// path, but with most image hosts you can use either (https or http) so its working for me now as expected.

  62. i have to say that your plugin is the worst thing ever, i use 100% external images and all the damn themes use this plugin so they are all usless to anyone trying to use external images. i have over 30k images on my site and it would take up to many resources to host them all on my site, so please fix this thing

    • Hi – I’m afraid if you don’t like it you’ll have to change it yourself. Opening up the script to resize images from any website is a massive security risk so I am not willing to risk the thousands of websites that use the script in this way. Additionally if you use the script it will cache the images on your server anyway so you will still end up hosting the 30000 images.

      As you say it’s used in many themes, and as such is used on many more sites so it can’t be that bad.

    • Hi – you should url encode the urls. In php it would be something like : $url = urlencode($url); and then echo that inplace of your previous url. Do that and it should resize fine

  63. Wow that is extremely cool! I was having trouble getting it to work, but then i re-read the directions. I didn’t have a temp folder so the script only worked on self-hosted images. Doh! I am usually really good about that too. But after my palm left my forehead, I got it squared away, added youtube to the approved sites and that works a treat. I’ve got a ways to go to get it to automatically pull youtube thumbs from embedded videos, but it is a really good start. Thanks so much.

  64. Hello Ben,

    Your contact form is not working, returns an error. http://www.binarymoon.co.uk/contact/

    I am trying to get animated .gif files to work with TimThumb …and in the process I have caused some sort of code error, as one set of images isn’t reducing or left justifying anymore.

    • Hi – I tried the contact form and it worked fine. Were you seeing an error when you tried it.

      Unfortunately I don’t think TimThumb works with animated gif files. To be honest I don’t remember ever trying one so I’m not sure what will happen. It does work fine with normal gifs though.

    • I’ve never tried editing gif files but I would guess it’s not as easy as a normal image file. The problem is there are multiple frames with paletted colours which means that even if I could work it out it would probably not look as good as you’d like. I will add it to the “to look into” list but I won’t make any promises I’m afraid.

  65. Can we make some changes in the script so that, it reads images with spaces (%20) in their path?

    Thanks for the great script,

  66. It definitely works w/ youtube.com but I am running into a difficulty in the way that youtube names their screenshot images.

    http://img.youtube.com/vi/aAYVY2eLMck/0.jpg

    Basically they ALL end in 0.jpg or the small ones are default.jpg. So then on my index page if I am displaying thumbnails for 4 different videos, timthumb displays the same thumbnail… I presume b/c they all look to have the same name?

    I know this is beyond the scope of support, but I am going to take a look at this today. If you had any work around suggestions I would really appreciate it. Perhaps it could be a cool feature to add to timthumb.

    Cheers,
    -kathy

  67. Ben,

    Thank you so much for your quick reply! I updated to the latest SVN version and you were right, that problem has already been taken care of. Awesome work. Thank you so much for sharing this with everyone!

    -Kathy

  68. hello,
    very great script, but I’m trying to get it working with youtube. Is there a way to “auto discover” a youtube video in a post (using wp) and get the image and thumbnail?

    thanks for your help!!!

  69. This script worked perfectly for me – I think this script would be great to resize profile pictures in conjunction with the Twitter/Facebook API so I’ll be eagerly awaiting any update with extended remote resizing features.

    Thanks!

    • Hi Mohsen – There’s going to be extra work for your cpu to do since the images are resized but i’ve done as much as I can to keep it nice and fast. The image caching is quite solid, and I am very conscious of keeping things fast so if you have any ideas for improving the speed I’d love to hear them.

  70. Hey there!
    Ive come across this neat page some time after my initial question.
    Ive installed this Version of Timthumb yet I get the same result.Images from Flickr arent showing up at all.
    I dont know where the problem might lie and hope you can give a newbie some hints where to look and what to try.

    Btw does the newest timthumb on google also allow pictures from Flickr?
    Thanks!

    • Hi – the version on Google code does work with Flickr (without modification if I remember correctly). I would use the version of the code that is on google code as it’s more up to date than this is.

  71. Thank you for the beta test vision it is really very useful for me, I am waiting for the advance version so that I’ll be able to add more remote images to my blog, I tested it with flicker and it works charm.

    • Hi – the final version is released on Google Code. In fact there have been quite a few releases since this post was written.

  72. Fantastic – Its just what I was looking for when I was migrating from an old domain to a newer one. I did not want to move the images, and the original timthumb did not work. This was so simple and works just as required. thanks millions.

  73. hi i think its a stupid question,,i m asking it ,,,how to change the default thumbnails size on the theme that uses timthumb ,,i m using latest version,,pls help

  74. Hello,

    I’ve used the normal timthumb before, and it works perfect! Very nice feature for some of my projects.

    But now I’m developing a website for a client, and I’m using images from Flickr on it. So then I tried the timthumb Beta with support for external sites. At first, the script could not produce the image I wanted. Now, the script seems to work, but the resized images do not appear on my site. However, they do appear in the cache folder as a .png. So the correct images do exist, but they don’t get displayed where I want them..

    Could you maybe help me out?
    Thanks in advance..

  75. Hi!
    My problemis that our thumbnails do not appears, because we are using remote img URLs. Our template is running Timthumb.
    But we simply cannot use imgs from the library, because the server is small, and to upload and download and resize the pics is a very big work, and takes a long time. So, we cannot use library pics, only remote img URL. Is there any way to avoid to show an empty pic place in the thumbnails? (I not need a pic at all, or I need one, but from remote img URL.) Any idea?
    Thx!

Leave a Reply

Your email address will not be published. Required fields are marked *

css.php