优米格
分享有营养的

WordPress缩略图TimThumb error解决

BraUndress.png

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);
赞(0)
未经允许禁止转载:优米格 » WordPress缩略图TimThumb error解决

评论 抢沙发

合作&反馈&投稿

商务合作、问题反馈、投稿,欢迎联系

广告合作侵权联系