timthumb.php 经常被用来生成缩略图,不过在某些系统上发现会出现如下错误

1
2
3
# A TimThumb error has occured
The following error(s) occured:
* Could not find the internal image you specified.

尝试了很多办法无效,最后不得已用增加配置文件指定绝对路径的办法解决的。

在 timthumb.php 同目录下增加 timthumb-config.php 内容如下

1
2
3
4
5
6
7
8
9
<?php
$_SERVER['DOCUMENT_ROOT'] = '/path/to/ur/root/path/';

//If you get this error at only localhost you can use like that also.

//if($_SERVER["HTTP_HOST"] == 'localhost'){
//$_SERVER['DOCUMENT_ROOT'] = dirname( __FILE__ );
//}
?>