WP thumbnails can't be displayed, open the thumbnails and prompt "A TimThumb error has occured"

When WP was IIS before, everything was normal. After switching to nginx, I found that the thumbnails could not be viewed and could not be displayed. After opening the thumbnails: 

Error message:
A TimThumb error has occured
Could not find the internal image you specified.

   Query String : src=http://my-host.it/wp-content/files_mf/1346848579prog_no_pic.png TimThumb version : 2.8.14

So a mad search on Baidu, and then can't solve it. The common solution is as follows: https://www.iianjing.com/1104.html

 

But my problem is not a general problem. I deleted and rebuilt the folder under CACHE. After accessing it, I found that files would still be generated in it, that is to say, it was not a permission problem. Besides, my environment was Windows, but I switched from IIS to nginx for some reason, resulting in It's normal to switch back, but my other stations are affected. The only way to go is Nginx, so I searched desperately, and finally, I found the dawn.

https://yq.aliyun.com/php/45543

Thanks to the author for the reminder, that's really the problem.

problem solving    

1. The cause of the problem

   The original problem is that TimThumb cannot find the image, which means that the path recognized by TimThumb is somewhat different from the path where the image is located.

2. Solutions

    Find timthumb.php in the theme to open it, use Ctrl+F to find

define('VERSION', 'Version number');

add a line before it

$_SERVER['DOCUMENT_ROOT'] = 'Path';

For example my path is /var/www/

//$_SERVER[‘DOCUMENT_ROOT’] = ‘/var/www/';

Because my server is WIN, all here is the address of win

$_SERVER[‘DOCUMENT_ROOT’] = ‘C:/XXX/wwwroot';

After saving, go back to the website to refresh, and find that the long-lost thumbnail has come out, and the problem has been solved;

At this time, I really feel like I can see the sunshine when I see the dark clouds.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325419411&siteId=291194637