图书馆:http://wiki.github.com/masterexploder/PHPThumb/basic-usage
我正在使用PhpThumbFactory库来裁剪和上传图片。我收到的错误是这样的:
Fatal error: Uncaught exception 'Exception' with message 'Image file not found: ' in /www/iaddesign/admin/classes/phpthumb/ThumbBase.inc.php:193
Stack trace:
#0 /www/iaddesign/admin/classes/phpthumb/ThumbBase.inc.php(172): ThumbBase->triggerError('Image file not ...')
#1 /www/iaddesign/admin/classes/phpthumb/ThumbBase.inc.php(110): ThumbBase->fileExistsAndReadable()
#2 /www/iaddesign/admin/classes/phpthumb/GdThumb.inc.php(96): ThumbBase->__construct('', false)
#3 /www/iaddesign/admin/classes/phpthumb/ThumbLib.inc.php(127): GdThumb->__construct('', Array, false)
#4 /www/iaddesign/admin/portfolio.php(29): PhpThumbFactory::create('')
#5 {main} thrown in /www/iaddesign/admin/classes/phpthumb/ThumbBase.inc.php on line 193
这是要上传图片的代码段。
/* -------------------------------------------------------------------- */
/* SAVE ICONS */
/* -------------------------------------------------------------------- */
$icononsrc = $_FILES['iconoff']['tmp_name'];
$iconoffsrc = $_FILES['iconon']['tmp_name'];
$thumboff = PhpThumbFactory::create($iconoffsrc);
$thumbon = PhpThumbFactory::create($icononsrc);
$thumboff->adaptiveResize(200,151);
$thumbon->adaptiveResize(200,151);
$thumboffname = "uploads/".$_FILES['iconoff']['name'];
$thumbonname = "uploads/".$_FILES['iconon']['name'];
$thumboff->save($thumboffname, 'jpg');
$thumbon->save($thumbonname, 'jpg');
答案 0 :(得分:0)
从堆栈跟踪中,检查文件是否存在且可读
#1 [cut] ThumbBase.inc.php(110): ThumbBase->fileExistsAndReadable()
抛出错误
#0 [cut] ThumbBase.inc.php(172): ThumbBase->triggerError('Image file not ...')
(请记住堆栈跟踪以相反的顺序出现)
我会从中推断出您尝试转换的文件名不存在,或者存在权限问题。确保该文件存在且具有适当的读取权限。