11 thoughts on “TimThumb Quality Settings Leave a comment

  1. I was in this little not aware group of people, so thanks for that πŸ˜‰ Sometimes it is realy good to write about something that most of us would seen as obvious.

    1. Glad it helped, and you’re totally right. There’s lots of things I take for granted that I forget others don’t know that could help them. I will always try to share these things if I can (if I think of them) πŸ™‚

  2. Hi!

    I have a problem when resizing images that are smaller than the width/height parameters on the Timthumb request.

    The thing is I’m using images from different (*external*) sources, and usually those images are bigger than my width/height and the resizing works perfect, but sometimes they are smaller, and I don’t want Timthumb to make them bigger, because then they look pixeled and awful…

    I’ve looked at the code and have tried to modify the MAX_WIDTH and MAX_HEIGHT constants based on new parameters (w2 and h2) but it didn’t work (strange)

    $max_width = (int) abs (get_request (‘w2’, 0));
    $max_height = (int) abs (get_request (‘h2’, 0));
    if ($max_width > 0) define (‘MAX_WIDTH’, $max_width);
    if ($max_height > 0) define (‘MAX_HEIGHT’, $max_height);

    // ensure size limits can not be abused
    $new_width = min ($new_width, MAX_WIDTH);
    $new_height = min ($new_height, MAX_HEIGHT);

    Thanks for this script, I’ve been using phpthumb for years and was really tired of it, and today I found it had a security bug (it was ignoring the nohotlinking parameters to allow only certain external webpages and just accepting everything, so dangerous!!!) and found out about Timbthumb, much simpler and effective, great! πŸ™‚

  3. Errr actually, that max_width max_height thing was a bit of a nonsense try…

    What I want is the image to show at its real size, in the case when its width and/or height is smaller than the width/height parameters, to avoid pixeling at all

  4. I have a problem. Finally got TT working after no thumbnail generation. However, now it’s defaulting to 10% quality even with this >>
    if(! defined(‘DEFAULT_Q’) ) define (‘DEFAULT_Q’, 75);

    Doesn’t matter what i set it to, still defaults to 10%. Any ideas? Not sure where it’s getting 10% from?

    An example is here >> http://lumenarte.co.uk/wp-content/themes/mio/sp-framework/timthumb/timthumb.php?src=http://lumenarte.co.uk/wp-content/uploads/2012/11/Aero_parete_2.jpg&h=500&w=500&zc=0&q=10&a=c&s=&f=&cc=&ct=

    Thanks if you can help.

    1. You shouldn’t be editing the code. The quality parameter is et in the timthumb parameters and you have set the quality (q value) to 10. The define is the default if q is not set.

  5. Hi!

    Could you please explain me the reason why a Timthumb cache file weights 386 KB for a 117 KB original file?
    Timthumb 2.8.11 quality parameter is set to 90%.

    Also, a strange thing that confuses me a lot is that if I set the quality parameter to 30%
    if(! defined(‘DEFAULT_Q’) ) define (‘DEFAULT_Q’, 30);
    and remove the cached file of the above-mentioned image and refresh my browser, the regenerated image is ugly (this is logical) but its cache file weights 409 KB!?!

    Thank you for explaining this mystery, if possible.


  6. I’ve 2 questions:

    1. To use your q quality fix, do I change this throughout the theme templates, or is this changeable at one place within the timthumb script itself?

    2. Same as above poster Eric asks, I’m recommended to optimize my images and it points to timthumb versions could be optimized a further 20%. However checking the timthumb cache these are 2-3 times larger than the image I’ve originally uploaded in the media folder! Why is this bloat and do you have any recommendations on how to fix?

Leave a Reply

Your email address will not be published.