本文介绍了PHP-GD imagejpeg无法打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当尝试保存使用GD制作的缩略图时

When trying to save a thumbnail made with GD

imagejpeg($tnImage, "../../img/thumbs/".$maxWidth."x".$maxHeight."_".$filename);

我遇到以下错误:

警告:imagejpeg()[function.imagejpeg]:无法打开"../../img/thumbs/80x80_55865-drops.jpg"进行写入: /home/user/workspace/stewart/server-side/libImg.php

Warning: imagejpeg() [function.imagejpeg]: Unable to open '../../img/thumbs/80x80_55865-drops.jpg' for writing: No such file or directory in /home/user/workspace/stewart/server-side/libImg.php

/home/user/workspace/img/thumbs的权限设置为0x777.

/home/user/workspace/img/thumbs has its permissions set to 0x777.

这有什么问题吗?

推荐答案

您从哪里运行文件?如果它来自server-side目录,那么我认为您缺少"../"

Where are you running the file from? If it's from the server-side directory then I think you're missing a "../"

尝试一下:

var_dump(realpath("../../img/thumbs/".$maxWidth."x".$maxHeight."_".$filename));

这篇关于PHP-GD imagejpeg无法打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-31 16:24