欢迎光临
感受代码之美

WordPress缩略图TimThumb error解决

wordpress访问报错:

wordpress-timthumb-error-allowed-sites.jpg

A TimThumb error has occured
The following error(s) occured:
You may not fetch images from that site. To enable this site in timthumb, you can either add it to $ALLOWED_SITES and set ALLOW_EXTERNAL=true. Or you can set ALLOW_ALL_EXTERNAL_SITES=true, depending on your security needs.

解决方式1

修改主题目录下的timthumb.php文件:

设置 ALLOW_EXTERNAL=true,

define ('ALLOW_EXTERNAL', true);

然后修改以下位置,增加外链网址:

// If ALLOW_EXTERNAL is true and ALLOW_ALL_EXTERNAL_SITES is false, then external images will only be fetched from these domains and their subdomains.
if(! isset($ALLOWED_SITES)){
        $ALLOWED_SITES = array (
                'flickr.com',
                'staticflickr.com',
                'picasa.com',
                'img.youtube.com',
                'upload.wikimedia.org',
                'photobucket.com',
                'imgur.com',
                'imageshack.us',
                'tinypic.com',
        );
}

解决方式2

这样允许所有外链网址:

/*
 * --- TimThumb CONFIGURATION ---
 * To edit the configs it is best to create a file called timthumb-config.php
 * and define variables you want to customize in there. It will automatically be
 * loaded by timthumb. This will save you having to re-edit these variables
 * everytime you download a new version
*/
define ('VERSION', '2.8.14');   // Version of this script
define ('ALLOW_ALL_EXTERNAL_SITES', true);
转载请注明来源:四个空格 » WordPress缩略图TimThumb error解决

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址