![](/img/trans.png)
[英]Warning: imagejpeg() [function.imagejpeg]: Unable to open 'broadcast_news_images/13331558akantony2.jpg' for writing: Permission denied in
[英]Warning: imagejpeg() [function.imagejpeg]: Unable to open [filename] for writing: No such file or directory
我无法弄清楚为什么我在尝试使用imagejpeg()保存图像时收到此错误
下面是我的代码的摘录,我已经删除了任何无关的东西,并保持足够产生错误。 路径肯定存在,并且权限设置为777。
$url = "http://website.com";
$filename = 'imagename';
$filepath = $url."/Images/accents/generated/".$filename.".jpg";
$base = imagecreatefromjpeg($url.'/images/'.$filename);
$imagewidth = imagesx($base);
$imageheight = imagesy($base);
$new = imagecreatetruecolor($imagewidth, $imageheight);
imagecopy($new, $base, 0, 0, 0, 0, $imagewidth, $imageheight);
imagejpeg($new, $filepath);
imagedestroy($new);
`
这可能是因为您尝试输出到url
而不是本地文档...
你的输出路径:
http://website.com/Images/accents/generated/imagename.jpg
这不起作用...输出必须是本地的,尝试类似于:
./Images/accents/generated/imagename.jpg
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.