24 thoughts on “TimThumb: Improved Speed and Other Changes Leave a comment

  1. Wow, I got here because of the external images issue (the version in the theme I was using was apparently OLD). The speed in this latest version is absolutely phenomenal. Must be some kind of quantum magic 🙂

  2. Great tool thank you oh so much! I need help with getting the program to delete the cached files. Any help would be great and thanks inadvance.

    Below are the setting in timThumb.php:
    // number of files to store before clearing cache
    define (‘CACHE_SIZE’, 30);

    // maximum number of files to delete on each cache clear
    define (‘CACHE_CLEAR’, 10);

    // use the cache files? (mostly for testing)
    define (‘CACHE_USE’, TRUE);

    // version number (to force a cache refresh)
    define (‘VERSION’, ‘1.19’);

    // cache directory
    define (‘DIRECTORY_CACHE’, ‘./cache’);

    1. Ben please review this line in the code.

      Cache-Control: max-age=864000

      This number = 240 HOURS.

      Should it be 86400 which = 24 hours

  3. Very cool! The youtube thing is the best, holy crap, I had no idea you could do that! I… must… kiss you now… no no, don’t fight it, it will only make things worse for you… lol

  4. Hi…quick question.
    I have tested the file and it works great with small and medium pictures but when I try with big high resolution pictures the script doesn’t work.

    I was wondering if you can post some tips regarding PHP.ini, server conf, hosting, etc…..i mean, what would be the best practice for thumbs…..Anyone?

    1. With large images you are likely to hit a php memory limit. The best solution is not to resize large pictures. I’ve certainly not had any big problems with resizing images so they must be really hefty.

      I don’t have any recommended specifications I am afraid. I have always just used the default settings with no complaints.

  5. Large images no problem. I’m using 1920pxx1080px size images.
    Yes, I’m on a virtual private server. My ISP defaults to 11Meg php memory limit.
    I’m using TimThumb to resize the above for full browser window background images.

    This works in all modern browers including iPhone, iPad etc. to detect the browser window height and width. Yes, it’s javascript.
    pagewidth=document.documentElement.clientWidth;
    pageheight=document.documentElement.clientHeight;

    I append that to the URL and read that with php to let TimThumb do it’s thing.
    <?php
    $w=$_GET['width'];
    $h=$_GET['height'];
    $string="”;
    echo($string);
    ?>

    Work in progress is at :
    http://www.downtownsanclemente.com/client4/

    1. Just use the latest version of TimThumb from Google Code. To use it, pass the youtube video url as the src parameter

      1. What changed in the code:

        ID, ‘thumb’, true) ) { ?>
        <a href="” rel=”bookmark” title=”Permanent Link to “><img class="fotnew" src="/timthumb.php?src=ID, “thumb”, $single = true); ?>&h=75&w=75&zc=1″ alt=”” width=”75″ height=”75″ />

      2. Sorry:

        <?php if ( get_post_meta($post->ID, ‘thumb’, true) ) { ?>
        <a href=”<?php the_permalink(); ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><img class=”fotnew” src=”<?php bloginfo(‘template_directory’); ?>/timthumb.php?src=<?php echo get_post_meta($post->ID, “thumb”, $single = true); ?>&h=75&w=75&zc=1″ alt=”<?php the_title(); ?>” width=”75″ height=”75″ /></a>
        <?php } ?>

  6. Hi there,

    Since yesterday I have found that a site that I’am developing is very slow to respond. 60+ seconds. After some searching I found out that when I turn timthumb of for a particular page the page loads as it should. with timthumb active 60+ seconds.

    I have used timthumb in many wordpress over the past couple of years, but I have had never this problem before. I updated the script from 2.8.10 to 2.8.11 and increased time between cleans and change max-age to 10 days instead of one.

    The site in question is b200.100200.nl/verhalen.

Leave a Reply

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