mysqlphp
我用的是新浪云sae,求帮忙看一下,多谢各位了。
Warning: imagejpeg() [function.imagejpeg]: Unable to open '123.jpg' for writing: Permission denied in 3.php on line 86
imagejpeg($newim,$name);
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body> <form action="3.php" method="post" enctype="multipart/form-data"><input type="file" name="file" id="file" /><br /><input type="submit" name="submit" value="Submit" /></form><?php//配置Storage的上传域、上传路径$domain = "lapiao";$path = "/uploads/";$upload_dir = "saestor://".$domain.$path;//如果路径不存在则新建if(!is_dir($upload_dir)){mkdir($upload_dir,0777);}//-------------------------上传 begin---------------- //移动目录 if(move_uploaded_file($_FILES["file"]["tmp_name"],$upload_dir.$_FILES["file"]['name'])){ $url = "http://".$_SERVER['HTTP_APPNAME']."-".$domain.".stor.sinaapp.com".$path.$_FILES["file"]['name']; echo '<br><br>'; echo '<br><br>'; echo "Image url:<br>".$url."<br/>"; echo "<img src='$url' / alt="mysql-PHP中这个语句imagejpeg($newim,$name);提示没有权限?" >";}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 '<br>'; echo $name; imagedestroy($newim); } else { $name = $name.$filetype; imagejpeg($im,$name); } }//$im=imagecreatefromjpeg("saestor:/".$_FILES["file"]["tmp_name"]);//参数是图片的存方路径$im=imagecreatefromjpeg("$url");//参数是图片的存方路径$maxwidth="50";//设置图片的最大宽度$max style="max-width:90%";//设置图片的最大高度$name="123";//图片的名称,随便取吧$filetype=".jpg";//图片类型resizeImage($im,$maxwidth,$maxheight,$name,$filetype);//调用上面的函数?> </body></html>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号