当前位置:Gxlcms > mysql > mysql-PHP中这个语句imagejpeg($newim,$name);提示没有权限?

mysql-PHP中这个语句imagejpeg($newim,$name);提示没有权限?

时间:2021-07-01 10:21:17 帮助过:34人阅读

mysqlphp

背景:

我用的是新浪云SAE,求帮忙看一下,多谢各位了。

错误提示:

Warning: imagejpeg() [function.imagejpeg]: Unable to open '123.jpg' for writing: Permission denied in 3.php on line 86

错误对应代码:

    imagejpeg($newim,$name);

全部代码:

     
'; echo '

'; echo "Image url:
".https://www.gxlcms.com/$url."
"; echo "";}function resizeImage($im,$maxwidth,$maxheight,$name,$filetype){ $pic_width = imagesx($im); $pic_height = imagesy($im); if(($maxwidth && $pic_width > $maxwidth) || ($maxheight && $pic_height > $maxheight)) { if($maxwidth && $pic_width>$maxwidth) { $widthratio = $maxwidth/$pic_width; $resizewidth_tag = true; } if($maxheight && $pic_height>$maxheight) { $heightratio = $maxheight/$pic_height; $resizeheight_tag = true; } if($resizewidth_tag && $resizeheight_tag) { if($widthratio<$heightratio) $ratio = $widthratio; else $ratio = $heightratio; } if($resizewidth_tag && !$resizeheight_tag) $ratio = $widthratio; if($resizeheight_tag && !$resizewidth_tag) $ratio = $heightratio; $newwidth = $pic_width * $ratio; $newheight = $pic_height * $ratio; if(function_exists("imagecopyresampled")) { $newim = imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($newim,$im,0,0,0,0,$newwidth,$newheight,$pic_width,$pic_height); } else { $newim = imagecreate($newwidth,$newheight); imagecopyresized($newim,$im,0,0,0,0,$newwidth,$newheight,$pic_width,$pic_height); } $name = $name.$filetype; //imagejpeg($newim,"http://lapiao-lapiao.stor.sinaapp.com/uploads/jpg.jpg"); //imagejpeg($newim,"saestor://lapiao/uploads/"); imagejpeg($newim,$name); echo $newim; echo '
'; echo $name; imagedestroy($newim); } else { $name = $name.$filetype; imagejpeg($im,$name); } }//$im=imagecreatefromjpeg("saestor:/".$_FILES["file"]["tmp_name"]);//参数是图片的存方路径$im=imagecreatefromjpeg("https://www.gxlcms.com/$url");//参数是图片的存方路径$maxwidth="50";//设置图片的最大宽度$maxheight="50";//设置图片的最大高度$name="123";//图片的名称,随便取吧$filetype=".jpg";//图片类型resizeImage($im,$maxwidth,$maxheight,$name,$filetype);//调用上面的函数?>

人气教程排行