【发布时间】:2012-07-19 23:35:53
【问题描述】:
我设法在浏览器上显示图像,但我无法使用 imagejpeg 保存它(我没有看到任何图像保存在服务器中)。我已经尝试了几个小时,并且还使用 is_writable 测试了该文件夹,正如其他人在PHP imagejpeg save file doesn't work 提出的这篇文章中提到的那样。 但它仍然不起作用,在 chrome 上,我没有看到任何错误,除了损坏的图像图标,但在 IE 上,它显示这样的错误 “警告:imagejpeg() [function.imagejpeg]:无法打开”文件不可写
这是我的代码。
header('Content-type: image/jpeg');
$filename = 'little.jpg';
$im = imagecreatefromjpeg($filename);
imagefilter($im, IMG_FILTER_CONTRAST,$_POST["amount"]);
imagejpeg($im,"test.jpg");
imagedestroy($im);
if (is_writable('test.jpg')) {
echo 'The file is writable';
} else {
echo 'The file is not writable';
}
有人可以帮忙吗?谢谢你。 P.S:我也想在浏览器上显示图片,同时保存图片。 imagejpeg 能做到吗?如果没有,有更好的方法吗?谢谢。
编辑:当我检查我的文件夹是否可写时,它回显“文件可写”,但当我检查 test.jpg 是否可写时,它回显“文件不可写”。
【问题讨论】: