上传时找不到 PHPthumbFactory 文件

发布于 2024-08-28 13:22:34 字数 1736 浏览 5 评论 0原文

库: https://github.com/masterexploder/PHPThumb/wiki/Basic-Usage< /a>

我正在使用 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');

library: https://github.com/masterexploder/PHPThumb/wiki/Basic-Usage

i am using the PhpThumbFactory library to crop and upload an image. the error im receiving is this:

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

here is the snippet that is for the image to be uploaded.

/* -------------------------------------------------------------------- */
/*                        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');

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮光之海 2024-09-04 13:22:35

从堆栈跟踪中,当检查文件是否存在并且可读时,

#1 [cut] ThumbBase.inc.php(110): ThumbBase->fileExistsAndReadable() 

会抛出错误

#0 [cut] ThumbBase.inc.php(172): ThumbBase->triggerError('Image file not ...') 

(请记住堆栈跟踪以相反的顺序出现),

我会从中推断出您尝试转换的文件名不存在,或者有权限问题。确保该文件存在并具有适当的读取权限。

From the stack trace, when checking if the file exists and is readable

#1 [cut] ThumbBase.inc.php(110): ThumbBase->fileExistsAndReadable() 

an error is thrown

#0 [cut] ThumbBase.inc.php(172): ThumbBase->triggerError('Image file not ...') 

(bear in mind the stack trace appears in reverse order)

I would infer from this that the file name you are trying to convert either doesn't exist, or has a permissions issue. Ensure that the file exists and has appropriate read permissions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文