问题是您正在尝试使用 timthumb.php 来调整不在您服务器上的图像的大小。
调整大小图像的实际错误是这样的:
不允许远程主机“ongmat.cz”
TimThumb 版本:1.14
解决方案是编辑 timthumb.php 脚本并更改第 24 行(或接近它)
// external domains that are allowed to be displayed on your website
$allowedSites = array (
'flickr.com',
'picasa.com',
'blogger.com',
'wordpress.com',
'img.youtube.com',
);
并添加您要从中使用图像的域,例如将 ongmat.cz 添加到数组中,使其看起来像这样:
$allowedSites = array (
'flickr.com',
'picasa.com',
'blogger.com',
'wordpress.com',
'img.youtube.com',
'ongmat.cz',
);
或者您可以更改此选项(虽然不那么安全)
define ('ALLOW_EXTERNAL', FALSE); // allow external website (override security precaution)
并将 FALSE 更改为 TRUE
前 30 行应如下所示:
/**
* TimThumb script created by Ben Gillbanks, originally created by Tim McDaniels and Darren Hoyt
* http://code.google.com/p/timthumb/
*
* GNU General Public License, version 2
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Examples and documentation available on the project homepage
* http://www.binarymoon.co.uk/projects/timthumb/
*/
define ('CACHE_SIZE', 250); // number of files to store before clearing cache
define ('CACHE_CLEAR', 5); // maximum number of files to delete on each cache clear
define ('CACHE_USE', FALSE); // use the cache files? (mostly for testing)
define ('VERSION', '1.16'); // version number (to force a cache refresh)
define ('DIRECTORY_CACHE', './cache'); // cache directory
define ('DIRECTORY_TEMP', './temp'); // temp directory
define ('MAX_WIDTH', 1000); // maximum image width
define ('MAX_HEIGHT', 1000); // maximum image height
define ('ALLOW_EXTERNAL', TRUE); // allow external website (override security precaution)
// external domains that are allowed to be displayed on your website
$allowedSites = array (
'flickr.com',
'picasa.com',
'blogger.com',
'wordpress.com',
'img.youtube.com',
'ongmat.cz',
);