加载图片时出现这样的错误Unable to open '../tcbb/images/cardtemp/2_0.gif' for writing: No such file or directory in /usr/local/www/qbbs/g_card.php on line 116是不是路径不对啊,我的路径里没有tcbb目录,我把路径改为 ‘images/cardtemp/’ 后提示:
denying for writing
比较的晕
谢谢大家
下面是我所有的代码$idx = 74;
$idy = 84;
$sexx = 88;
$sexy = 120;
$declarex = 40;
$declarey = 177;$uploadImagePath = "../tcbb/images/cardtemp/";$background = imagecreatetruecolor(478, 250);
$white = imagecolorallocate($background, 0, 255, 255);
imagefill($background, 0, 0, $white);//transparent copy image
$imgfile = "images/cardgif/back/".$_POST['typesel'];$insert = imagecreatefromgif($imgfile);
imagecolortransparent($insert,imagecolorat($insert,0,0));
$insert_x = imagesx($insert);
$insert_y = imagesy($insert);
imagecopy($background,$insert,0,0,0,0,$insert_x,$insert_y);$imgfile = "images/cardgif/people/".$_POST['charsel'];
$insert = imagecreatefromgif($imgfile);
imagecolortransparent($insert,imagecolorat($insert,0,0));
$insert_x = imagesx($insert);
$insert_y = imagesy($insert);
if ($_POST['charsel'] =='tm/tm1.gif') {imagecopy($background,$insert,190,45,0,0,$insert_x,$insert_y);}
if ($_POST['charsel'] =='tm/tm2.gif') {imagecopy($background,$insert,150,55,0,0,$insert_x,$insert_y);}
if ($_POST['charsel'] =='tm/tm3.gif') {imagecopy($background,$insert,155,50,0,0,$insert_x,$insert_y);}$xiaoming=0;
$files = glob($uploadImagePath.$user_id.'_'."*.gif");
if ($files['0']!=""){@unlink($files['0']);$files1=explode("_",$files['0']);$files2=strstr($files1['1'],'.');$files3=str_replace($files2,"",$files1['1']);$files3++;$xiaoming=$files3;}
$realname = $user_id.'_'.$xiaoming.".gif";
$filename=$uploadImagePath.$realname;imagecolortransparent($background, imagecolorat($background,0,0));$backwidth = imagesx($background);
$shadow = imagecolorclosest($background, 255, 204, 0);$colorarray=array(
                "baifenghuang.gif"=>imagecolorallocate($background, 17, 159, 17),
                "chilian.gif"=>imagecolorallocate($background, 207, 65, 17),
                "datiechui.gif"=>imagecolorallocate($background, 207, 65, 17),
                "duanmurong.gif"=>imagecolorallocate($background, 66, 66, 179),
                "gaoyue.gif"=>imagecolorallocate($background, 250, 142, 132)
);//$textcolor = imagecolorallocate($background, 51, 51, 51);
//$textcolor = $colorarray[$_POST['typesel']];
$tc1=substr($_POST['font_color'],1,2);$tc11='0x'.$tc1;$tc11  +=  0;$tc2=substr($_POST['font_color'],3,2);$tc12='0x'.$tc2;$tc12  +=  0;
$tc3=substr($_POST['font_color'],5,2);$tc13='0x'.$tc3;$tc13  +=  0;
$textcolor =imagecolorallocate($background, $tc11, $tc12, $tc13);drawtext($background,$idx, $idy-23,$textcolor, 8, $_POST['usrid']);
drawtext($background,$sexx, $sexy-25, $textcolor, 5, $_POST['sex']);
drawtext1($background,$declarex, $declarey-25, $textcolor, 10, $_POST['usrtext']);
drawtext2($background,$declarex, $declarey-5, $textcolor, 10, $_POST['usrtext']);
if (imagetypes() & IMG_GIF) {   imagegif ($background,$filename,100);

解决方案 »

  1.   

    Linux系统?
    用chmod修改目录权限为可写。
      

  2.   

    你用realpath看下真实的路径下有没有文件
      

  3.   

    显然你贴的代码不足,仅60余行。
    而错误出现在 116 行!!!
    Unable to open '../tcbb/images/cardtemp/2_0.gif' for writing: No such file or directory in /usr/local/www/qbbs/g_card.php on line 116
      

  4.   

    谢谢大家,昨天忙,忘了回帖,对不住大家,现已解决,如上面的仁兄所说,是权限不够,用了
    chmod修改了下就好了