Wordpress | Thumbnail Resizer (timthumb.php) Problem


#1

Okay, I’ve got this eBusiness theme on wordpress which automatically resizes pictures in thumbnails using the timthumb.php script.

My website is: www.empirebooks.co.cc

It contains a slider near the top of the page with a thumbnail which uses the script. I’ve put in an image in the same folder of the script because it didn’t work when I put it anywhere else. It still doesn’t work.

Here is the script: http://timthumb.googlecode.com/svn/trunk/timthumb.php

If you go to my website or the link below you can see the script generates a broken image. I’ve followed all the FAQ on timthumb on the net and it still does not work. The only problem left resides with the web host.

http://www.empirebooks.co.cc/wp-content/themes/eBusiness/timthumb.php?src=/wp-content/themes/eBusiness/thumb-1.jpg&h=192&w=334&zc=1

Can someone tell me what’s wrong? Many thanks.


#2

Your hotlink blocker works at least :stuck_out_tongue:

Have you disable the analytics (how is in my signature) as that can cause issues?


#3

Yeah I’ve disabled the analytics and it still doesn’t work.

Will my hotlink blocker cause issues?


#4

Here is the timthumb troubleshooting guide on the theme providers website. Here.

There are only two questions left unanswered and they lie with the server or host:

Does your server have the GD library compiled with its version of PHP?

Does your server have mod_security settings that are impeding the scripts functionality?

There is also an error message when I try view the image standalone:

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/local/apache/htdocs/www/embed src=) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /home/a5770396/public_html/wp-content/themes/eBusiness/timthumb.php on line 567

Line 567:

if (file_exists($path . $src)) {

What is wrong? :frowning:


#5

I just solve this problem with modifying some codes for function “show_cache_file” for my blog. I use “ob_clean” to clean the previous buffer bytes for those consist warning messages, after that I only start to do buffering for those image bytes want to send out and it is working now for my blog http://www.ycoderz.co.cc/blog The modified code of “show_cache_file” as below:

        
function show_cache_file ($cache_dir, $mime_type) {
    $cache_file = $cache_dir . '/' . get_cache_file();

    if (file_exists($cache_file)) {

        $gmdate_mod = gmdate("D, d M Y H:i:s", filemtime($cache_file));

        if(! strstr($gmdate_mod, "GMT")) {
            $gmdate_mod .= " GMT";
        }

        if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])) {

            // check for updates
            $if_modified_since = preg_replace ("/;.*$/", "", $_SERVER["HTTP_IF_MODIFIED_SINCE"]);

            if ($if_modified_since == $gmdate_mod) {
                header("HTTP/1.1 304 Not Modified");
                die();
            }

        }

        $fileSize = filesize ($cache_file);
       
        $buffer = file_get_contents($cache_file);

        ob_get_clean();
        ob_start();



        header ('Last-Modified: ' . $gmdate_mod);
        header ('Cache-Control: max-age=9999, must-revalidate');
        header ('Expires: ' . $gmdate_mod);
        header ('Accept-Ranges: bytes');
        header ('Content-Type: ' . $mime_type);
        header ('Content-Length: ' . $fileSize);

        echo $buffer;
        $sContents = ob_get_contents();
        ob_end_clean();
        echo $sContents;
}

Please let me know if you have a better solution. Thanks.


#6

Thank you very much **leologger **

Your code solved my problem with ‘timthumb.php’ & his cache folder.

You are Great Programmer ! :slight_smile: