首 页   · 站长博客 · 用户注册 · 会员登陆  · 会员排行  ·最新主题  ·最近回复  精华区  版权声明  ·论坛管理
  当前登录身份:游客,请先登录。  笔名: 口令: 验证码:   
楼 主  index »  Simsma技术支持专区 » PHP生成缩略图时出错,不能创建文件,有文件名分配。  


  作者:mznflee
  注册时间:2008-03-19
  主题/回复:1/0
  积分:30
  等级:★(二级)
  称号:初出茅庐

用户联系方式已设置为保密

 

 发表:2008-03-19 03:12:20 阅读 3301 次 回复 1 次 得分1  |   字号 字色
PHP生成缩略图时出错,不能创建文件,有文件名分配。
PHP生成缩略图时出错,不能创建文件,有文件名分配。


PHP生成缩略图时出错,不能创建文件,有文件名分配。 

--------------------------------------------------------------------------------

PHP生成缩略图时出错,不能创建文件,有文件名分配。

出错代码:
Warning:imagecreatefromjpeg()pen_basedir restriction in effect,file(/upload/goods/c21242.jpg)is not within the allowed path(s):
(d:/hosting/wwwroot/;d:/hosting/system/;c:/windows/temp)in d:/hosting/wwwroot/iemi_com/htdocs/admin/goods_write_ok.php on line 399
warning:imagecreatefromjpeg(/upload/goods/c21242.jpg):failed to open streamperation not permitted in d:/hosting/wwwroot/iemi_com/htdocs/admin/goods_write_ok.php on line 399
warning:imagesx():supplied argument is not a valid image resource in d:/hosting/wwwroot/iemi_com/htdocs/admin/goods_write_ok.php on line 404
warning:imagesy():supplied argument is not a valid image resource in d:/hosting/wwwroot/iemi_com/htdocs/admin/goods_write_ok.php on line 404
warning:imagecopyresampled():supplied argument is not a valid image resource in d:/hosting/wwwroot/iemi_com/htdocs/admin/goods_write_ok.php on line 404
Warning:imagejpeg()pen_basedir restriction in effect,file(/upload/goods/gd_c21242.jpg)is not within the allowed path(s):
(d:/hosting/wwwroot/;d:/hosting/system/;c:/windows/temp)in d:/hosting/wwwroot/iemi_com/htdocs/admin/goods_write_ok.php on line 405
..................

goods_write_ok.php文件源代码:

<?
include "head.php";
if(!defined(__ADMIN_ROW))
{
define(__ADMIN_ROW,"TRUE");
$admin_row=$MySQL->fetch_array("select *from admin limit 0,1");//&#44288;&#47532;&#51088;&#51221;&#48372;
}
if(!$bHtml) $content = $TextContent;
elseif($bHtml==2) $content = $HtmlContent;
else $content = $content;
$GD_SET = $admin_row[bGdset];
// GD &#47484; &#50948;&#54620;
$SCRIPT_FILENAME_ARR = explode("admin",$_SERVER["SCRIPT_FILENAME"]);
$host = $SCRIPT_FILENAME_ARR[0];
if (substr($host,-1)=="/") $host = Laststrcut($host);
if (substr($admin_row[shopUrl],-1)=="/") $admin_row[shopUrl] = Laststrcut($admin_row[shopUrl]);
$home_url = $host."/upload/goods/";
$http_url = "http://$admin_row[shopUrl]"."/upload/goods/";
if ($bWmark=="y")
{
$wm_info = getimagesize("../upload/watermark_img");
$wm_file = "/upload/watermark_img";
$targetfile = $home_url.$src_file;
if ($wm_info[2]==2)
{
$wm_type = "jpg";
$insertfile_id = ImageCreateFromJPEG($host.$wm_file);
}
else if ($wm_info[2]==1)
{
$wm_type = "gif";
$insertfile_id = ImageCreateFromGIF($host.$wm_file);
}
else $wm_type="";
}

if(empty($price)) $price =0;
if(empty($bOldPrice)) $bOldPrice=0;
if(empty($str_oldPrice)) $str_oldPrice =0;
if(empty($point)) $point=0;
if(empty($setVal)) $setVal=0;
if(empty($bCompany)) $bCompany=0;
if(empty($bOrigin)) $bOrigin =0;
if(empty($bLimit)) $bLimit=0;
if(empty($str_limitCnt)) $str_limitCnt=0;
if(empty($bHit)) $bHit =0;
if(empty($bNew)) $bNew =0;
if(empty($bEtc)) $bEtc =0;
if(empty($bHtml)) $bHtml=0;
if(empty($point)) $point=0;
if(empty($img_onetoall)) $img_onetoall=0;
if(empty($margin) || (!is_numeric($margin))) $margin=0;
if(empty($supplyprice)) $supplyprice=0;
if(empty($bOptionPrice)) $bOptionPrice=0;
if (strlen($month)==1) $month = "0".$month;
if (strlen($month2)==1) $month2 = "0".$month2;
if (strlen($day)==1) $day = "0".$day;
if (strlen($day2)==1) $day2 = "0".$day2;
if(empty($minbuyCnt)) $minbuyCnt=0;
if(empty($maxbuyCnt)) $maxbuyCnt=0;
function imgalldel()
{
global $img1_name,$img2_name,$img3_name,$img4_name,$img5_name,$img6_name,$img7_name,$img8_name;
global $detailimg1_name,$detailimg2_name,$detailimg3_name,$detailimg4_name;
if(is_file("../upload/goods/$img1_name")) @unlink("../upload/goods/$img1_name");
if(is_file("../upload/goods/$img2_name")) @unlink("../upload/goods/$img2_name");
if(is_file("../upload/goods/$img3_name")) @unlink("../upload/goods/$img3_name");
if(is_file("../upload/goods/$img4_name")) @unlink("../upload/goods/$img4_name");
if(is_file("../upload/goods/$img5_name")) @unlink("../upload/goods/$img5_name");
if(is_file("../upload/goods/$img6_name")) @unlink("../upload/goods/$img6_name");
if(is_file("../upload/goods/$img7_name")) @unlink("../upload/goods/$img7_name");
if(is_file("../upload/goods/$img8_name")) @unlink("../upload/goods/$img8_name");
if(is_file("../upload/goods/$detailimg1_name")) @unlink("../upload/goods/$detailimg1_name");
if(is_file("../upload/goods/$detailimg2_name")) @unlink("../upload/goods/$detailimg2_name");
if(is_file("../upload/goods/$detailimg3_name")) @unlink("../upload/goods/$detailimg3_name");
if(is_file("../upload/goods/$detailimg4_name")) @unlink("../upload/goods/$detailimg4_name");
}
// &#51060;&#48120;&#51648;&#46321;&#47197;
if(!empty($img1_name))
{
$img1_info=@getimagesize($img1); //&#51060;&#48120;&#51648;1 &#51221;&#48372;
if(($img1_info[2]!=1) && ($img1_info[2]!=2))
{
MsgView("&#51089;&#51008;&#51060;&#48120;&#51648; &#54805;&#49885;&#51012; gif , jpg &#47196; &#51077;&#47141;&#54644; &#51452;&#49464;&#50836;", -1);
exit;
}
$img1_name ="a".substr(time(),5,5)."_".$img1_name;
$img1_name = str_replace(" ","",$img1_name);
@move_uploaded_file($img1, "../upload/goods/$img1_name"); //&#54028;&#51068;&#48373;&#49324;
@unlink($img1);
}
if(!empty($img2_name))
{
$img2_info=@getimagesize($img2); //&#51060;&#48120;&#51648;2 &#51221;&#48372;
if(($img2_info[2]!=1) && ($img2_info[2]!=2))
{
imgalldel();
MsgView("&#53360;&#51060;&#48120;&#51648; &#54805;&#49885;&#51012; gif , jpg &#47196; &#51077;&#47141;&#54644; &#51452;&#49464;&#50836;", -1);
exit;
}
$img2_name ="b".substr(time(),5,5)."_".$img2_name;
$img2_name = str_replace(" ","",$img2_name);
@move_uploaded_file($img2, "../upload/goods/$img2_name"); //&#54028;&#51068;&#48373;&#49324;
@unlink($img2);
}
if(!empty($img3_name))
{
$img3_info=@getimagesize($img3); //&#51060;&#48120;&#51648;3 &#51221;&#48372;
if(($img3_info[2]!=1) && ($img3_info[2]!=2))
{
imgalldel();
MsgView("&#54869;&#45824;&#51060;&#48120;&#51648;[1] &#54805;&#49885;&#51012; gif , jpg &#47196; &#51077;&#47141;&#54644; &#51452;&#49464;&#50836;", -1);
exit;
}
$img3_name ="c".substr(time(),5,5)."_".$img3_name;
$img3_name = str_replace(" ","",$img3_name);
@move_uploaded_file($img3, "../upload/goods/$img3_name"); //&#54028;&#51068;&#48373;&#49324;
// &#50892;&#53552;&#47560;&#53356; &#49341;&#51077; &#49324;&#50857;&#49884;
if ($bWmark=="y")
{
make_wmark($img3_name,$img3_info);
}
@unlink($img3);
}
if(!empty($img4_name))
{
$img4_info=@getimagesize($img4);
if(($img4_info[2]!=1) && ($img4_info[2]!=2))
{
imgalldel();
MsgView("&#54869;&#45824;&#51060;&#48120;&#51648;[2] &#54805;&#49885;&#51012; gif , jpg &#47196; &#51077;&#47141;&#54644; &#51452;&#49464;&#50836;", -1);
exit;
}
$img4_name ="d".substr(time(),5,5)."_".$img4_name; 
$img4_name = str_replace(" ","",$img4_name);
@move_uploaded_file($img4, "../upload/goods/$img4_name"); //&#54028;&#51068;&#48373;&#49324;
// &#50892;&#53552;&#47560;&#53356; &#49341;&#51077; &#49324;&#50857;&#49884;
if ($bWmark=="y")
{
make_wmark($img4_name,$img4_info);
}
@unlink($img4);
}
if(!empty($img5_name))
{
$img5_info=@getimagesize($img5);
if(($img5_info[2]!=1) && ($img5_info[2]!=2))
{
imgalldel();
MsgView("&#54869;&#45824;&#51060;&#48120;&#51648;[3] &#54805;&#49885;&#51012; gif , jpg &#47196; &#51077;&#47141;&#54644; &#51452;&#49464;&#50836;", -1);
exit;
}
$img5_name ="e".substr(time(),5,5)."_".$img5_name;
$img5_name = str_replace(" ","",$img5_name);
@move_uploaded_file($img5, "../upload/goods/$img5_name"); //&#54028;&#51068;&#48373;&#49324;
// &#50892;&#53552;&#47560;&#53356; &#49341;&#51077; &#49324;&#50857;&#49884;
if ($bWmark=="y")
{
make_wmark($img5_name,$img5_info);
}
@unlink($img5);
}
if(!empty($img6_name))
{
$img6_info=@getimagesize($img6);
if(($img6_info[2]!=1) && ($img6_info[2]!=2))
{
imgalldel();
MsgView("&#54869;&#45824;&#51060;&#48120;&#51648;[4] &#54805;&#49885;&#51012; gif , jpg &#47196; &#51077;&#47141;&#54644; &#51452;&#49464;&#50836;", -1);
exit;
}
$img6_name ="f".substr(time(),5,5)."_".$img6_name;
$img6_name = str_replace(" ","",$img6_name);
@move_uploaded_file($img6, "../upload/goods/$img6_name"); //&#54028;&#51068;&#48373;&#49324;
// &#50892;&#53552;&#47560;&#53356; &#49341;&#51077; &#49324;&#50857;&#49884;
if ($bWmark=="y")
{
make_wmark($img6_name,$img6_info);
}
@unlink($img6);
}
if(!empty($img7_name))
{
$img7_info=@getimagesize($img7);
if(($img7_info[2]!=1) && ($img7_info[2]!=2))
{
imgalldel();
MsgView("&#54869;&#45824;&#51060;&#48120;&#51648;[5] &#54805;&#49885;&#51012; gif , jpg &#47196; &#51077;&#47141;&#54644; &#51452;&#49464;&#50836;", -1);
exit;
}
$img7_name ="g".substr(time(),5,5)."_".$img7_name;
$img7_name = str_replace(" ","",$img7_name);
@move_uploaded_file($img7, "../upload/goods/$img7_name"); //&#54028;&#51068;&#48373;&#49324;
// &#50892;&#53552;&#47560;&#53356; &#49341;&#51077; &#49324;&#50857;&#49884;
if ($bWmark=="y")
{
make_wmark($img7_name,$img7_info);
}
@unlink($img7);
}
if(!empty($img8_name))
{
$img8_info=@getimagesize($img8);
if(($img8_info[2]!=1) && ($img8_info[2]!=2))
{
imgalldel();
MsgView("&#54869;&#45824;&#51060;&#48120;&#51648;[6] &#54805;&#49885;&#51012; gif , jpg &#47196; &#51077;&#47141;&#54644; &#51452;&#49464;&#50836;", -1);
exit;
}
$img8_name ="h".substr(time(),5,5)."_".$img8_name;
$img8_name = str_replace(" ","",$img8_name);
@move_uploaded_file($img8, "../upload/goods/$img8_name"); //&#54028;&#51068;&#48373;&#49324;
// &#50892;&#53552;&#47560;&#53356; &#49341;&#51077; &#49324;&#50857;&#49884;
if ($bWmark=="y")
{
make_wmark($img8_name,$img8_info);
}
@unlink($img8);
}
if(!empty($detailimg1_name))
{
$detailimg1_info=@getimagesize($detailimg1);
if(($detailimg1_info[2]!=1) && ($detailimg1_info[2]!=2))
{
imgalldel();
MsgView("&#49345;&#49464;&#51060;&#48120;&#51648;[1] &#54805;&#49885;&#51012; gif , jpg &#47196; &#51077;&#47141;&#54644; &#51452;&#49464;&#50836;", -1);
exit;
}
$detailimg1_name ="h".substr(time(),5,5)."_".$detailimg1_name;
$detailimg1_name = str_replace(" ","",$detailimg1_name);
@move_uploaded_file($detailimg1, "../upload/goods/$detailimg1_name"); //&#54028;&#51068;&#48373;&#49324;
@unlink($detailimg1);
@unlink("../upload/goods/$goods_row[detailimg1]"); //&#48376;&#51060;&#48120;&#51648; &#49325;&#51228;
}
if(!empty($detailimg2_name))
{
$detailimg2_info=@getimagesize($detailimg2);
if(($detailimg2_info[2]!=1) && ($detailimg2_info[2]!=2))
{
imgalldel();
MsgView("&#49345;&#49464;&#51060;&#48120;&#51648;[2] &#54805;&#49885;&#51012; gif , jpg &#47196; &#51077;&#47141;&#54644; &#51452;&#49464;&#50836;", -1);
exit;
}
$detailimg2_name ="h".substr(time(),5,5)."_".$detailimg2_name;
$detailimg2_name = str_replace(" ","",$detailimg2_name);
@move_uploaded_file($detailimg2, "../upload/goods/$detailimg2_name"); //&#54028;&#51068;&#48373;&#49324;
@unlink($detailimg2);
@unlink("../upload/goods/$goods_row[detailimg2]"); //&#48376;&#51060;&#48120;&#51648; &#49325;&#51228;
}
if(!empty($detailimg3_name))
{
$detailimg3_info=@getimagesize($detailimg3);
if(($detailimg3_info[2]!=1) && ($detailimg3_info[2]!=2))
{
imgalldel();
MsgView("&#49345;&#49464;&#51060;&#48120;&#51648;[3] &#54805;&#49885;&#51012; gif , jpg &#47196; &#51077;&#47141;&#54644; &#51452;&#49464;&#50836;", -1);
exit;
}
$detailimg3_name ="h".substr(time(),5,5)."_".$detailimg3_name;
$detailimg3_name = str_replace(" ","",$detailimg3_name);
@move_uploaded_file($detailimg3, "../upload/goods/$detailimg3_name"); //&#54028;&#51068;&#48373;&#49324;
@unlink($detailimg3);
@unlink("../upload/goods/$goods_row[detailimg3]"); //&#48376;&#51060;&#48120;&#51648; &#49325;&#51228;
}
if(!empty($detailimg4_name))
{
$detailimg4_info=@getimagesize($detailimg4);
if(($detailimg4_info[2]!=1) && ($detailimg4_info[2]!=2))
{
imgalldel();
MsgView("&#49345;&#49464;&#51060;&#48120;&#51648;[4] &#54805;&#49885;&#51012; gif , jpg &#47196; &#51077;&#47141;&#54644; &#51452;&#49464;&#50836;", -1);
exit;
}
$detailimg4_name ="h".substr(time(),5,5)."_".$detailimg4_name;
$detailimg4_name = str_replace(" ","",$detailimg4_name);
@move_uploaded_file($detailimg4, "../upload/goods/$detailimg4_name"); //&#54028;&#51068;&#48373;&#49324;
@unlink($detailimg4);
@unlink("../upload/goods/$goods_row[detailimg4]"); //&#48376;&#51060;&#48120;&#51648; &#49325;&#51228;
}
$name = addslashes_userfc(trim($name));
$meta_str = addslashes_userfc(trim($meta_str));
$content = addslashes_userfc(trim($content));
$company = addslashes_userfc($company);

// 1&#52264; &#52852;&#53580;&#44256;&#47532; &#53076;&#46300;&#51221;&#48372; &#50619;&#44592;
$parent_row = $MySQL->fetch_array("SELECT code,deep,reid from category WHERE code='$category' limit 1");
if ($parent_row[deep]==0) $parent_code = $parent_row
代码如下:;
else if ($parent_row[deep]==1) $parent_code = $parent_row[reid];
else
{
$reid_arr = explode(",",$parent_row[reid]);
$parent_code = $reid_arr[0];
}
$qry = "insert into goods(category,code,name,price,bOldPrice,oldPrice,";
$qry.= "point,bCompany,company,bOrigin,origin,bLimit,limitCnt,bHit,bNew,bEtc,";
$qry.= "partName1,partName2,partName3,strPart1,strPart2,strPart3,";
$qry.= "img1,img2,img3,img4,img5,img6,img7,img8,";
$qry.= "bHtml,content,writeday,position,readCnt,setVal,bOptionPrice,img_onetoall,";
$qry.= "supplyprice,margin,detailimg1,detailimg2,detailimg3,detailimg4,total_option_str,total_option_name,";
$qry.= "meta_str,size,model,bOptionStock,";
$qry.= "chango,quality,bWmark,minbuyCnt,maxbuyCnt,trans_content,reid_category,sale,bSaleper,relation";
$qry.= ") values(";
$qry.= "'$category',"; //&#49345;&#54408;&#52852;&#53580;&#44256;&#47532; &#53076;&#46300;
$qry.= "'$code',"; //&#49345;&#54408;&#53076;&#46300;
$qry.= "'$name',"; //&#49345;&#54408;&#47749;
$qry.= "$price,"; //&#44032;&#44201;
$qry.= "$bOldPrice,"; //&#49884;&#51473;&#44032;&#49324;&#50857; ex)1:&#49324;&#50857; 0:&#48120;&#49324;&#50857;
$qry.= "$str_oldPrice,"; //&#49884;&#51473;&#44032;
$qry.= "$point,"; //&#51201;&#47549;&#44552;
$qry.= "$bCompany,"; //&#51228;&#51312;&#49324;&#49324;&#50857; ex)1:&#49324;&#50857; 0:&#48120;&#49324;&#50857;
$qry.= "'$str_company',"; //&#51228;&#51312;&#49324;
$qry.= "$bOrigin,"; //&#50896;&#49328;&#51648;&#49324;&#50857; ex)1:&#49324;&#50857; 0:&#48120;&#49324;&#50857;
$qry.= "'$str_origin',"; //&#50896;&#49328;&#51648;
$qry.= "$bLimit,"; //&#51116;&#44256;&#49688;&#47049;&#49324;&#50857; ex)1:&#49324;&#50857; 0:&#48120;&#49324;&#50857;
$qry.= "$str_limitCnt,"; //&#51116;&#44256;&#49688;&#47049;
$qry.= "$bHit,"; //hit &#51060;&#48120;&#51648;&#49324;&#50857; ex)1:&#49324;&#50857; 0:&#48120;&#49324;&#50857;
$qry.= "$bNew,"; //new &#51060;&#48120;&#51648;&#49324;&#50857; ex)1:&#49324;&#50857; 0:&#48120;&#49324;&#50857;
$qry.= "$bEtc,"; //etc &#51060;&#48120;&#51648;&#49324;&#50857; ex)1:&#49324;&#50857; 0:&#48120;&#49324;&#50857;
$qry.= "'$partName1',"; //
$qry.= "'$partName2',"; //&#49549;&#49457;&#47749; ex)'&#49353;&#44628;','&#49324;&#51060;&#51592;',....
$qry.= "'$partName3',"; //
$qry.= "'$strPart1',"; //
$qry.= "'$strPart2',"; //&#49549;&#49457; ex)&#45432;&#46993;」「&#48744;&#44053;」「&#54028;&#46993;」「&#44160;&#51221;
$qry.= "'$strPart3',"; //
$qry.= "'$img1_name',"; //&#49345;&#54408;&#51060;&#48120;&#51648;
$qry.= "'$img2_name',";
$qry.= "'$img3_name',";
$qry.= "'$img4_name',"; //&#49345;&#54408;&#51060;&#48120;&#51648;
$qry.= "'$img5_name',";
$qry.= "'$img6_name',";
$qry.= "'$img7_name',"; //&#49345;&#54408;&#51060;&#48120;&#51648;
$qry.= "'$img8_name',";
$qry.= "$bHtml,"; //&#49345;&#54408;&#49345;&#49464; &#51221;&#48372; html&#49324;&#50857; 1:&#49324;&#50857; 0:&#48120;&#49324;&#50857;
$qry.= "'$content',"; //&#49345;&#54408;&#49345;&#49464; &#51221;&#48372;
$qry.= "now(),"; //&#46321;&#47197;&#51068;
$qry.= "'$str_position',"; //&#53945;&#51221; &#50948;&#52824;
$qry.= "0, "; //&#51312;&#54924;&#49688;
$qry.= "$setVal,"; //&#49345;&#54408;&#51652;&#50676; &#50864;&#49440;&#49692;&#50948; ex)1 ~ 10
$qry.= "$bOptionPrice,"; //&#50741;&#49496;&#48324; &#44032;&#44201;&#49444;&#51221; &#49324;&#50857;&#50668;&#48512; ex) 0:&#48120;&#49324;&#50857; 1:&#49324;&#50857;
$qry.= "$img_onetoall,";
$qry.= "$supplyprice,";
$qry.= "$margin,";
$qry.= "'$detailimg1_name',";
$qry.= "'$detailimg2_name',";
$qry.= "'$detailimg3_name',";
$qry.= "'$detailimg4_name',";
$qry.= "'$total_option_str',";
$qry.= "'$total_option_name',";
$qry.= "'$meta_str',";
$qry.= "'$size',";
$qry.= "'$model',";
$qry.= "'$bOptionStock',";
$qry.= "'$chango',"; 
$qry.= "'$quality',";
$qry.= "'$bWmark',";
$qry.= "$minbuyCnt,";
$qry.= "$maxbuyCnt,";
$qry.= "'$trans_content',";
$qry.= "'$parent_code',";
$qry.= "'$sale',";
$qry.= "'$bSaleper',";
$qry.= "'$relation'";
$qry.= ")";
if($MySQL->query($qry))
{
OnlyMsgView("&#46321;&#47197;&#50756;&#47308; &#54616;&#50688;&#49845;&#45768;&#45796;.");

// GD &#51060;&#48120;&#51648; &#49373;&#49457; 2.0 &#51060;&#49345; &#49483;&#54021;&#46096;&#51012;&#49884;
if ($img_onetoall && $GD_SET=="y")
{
if (empty($img1_name) && empty($img2_name)) // &#51060;&#48120;&#51648;1,2 &#44032; &#50630;&#51012;&#46412; &#49352;&#47196; &#49373;&#49457; 
{
if(!defined(__DESIGN_GOODS_ROW))
{
define(__DESIGN_GOODS_ROW,"TRUE");
$design_goods=$MySQL->fetch_array("select *from design_goods limit 0,1");
}
$GDIMG1_WIDTH = $design_goods[gdimg1_width];
$GDIMG1_HEIGHT = $design_goods[gdimg1_height];
$GDIMG2_WIDTH = $design_goods[gdimg2_width];
$GDIMG2_HEIGHT = $design_goods[gdimg2_height];
if (!$GDIMG1_WIDTH) $GDIMG1_WIDTH = 100;
if (!$GDIMG1_HEIGHT) $GDIMG1_HEIGHT = 100;
if (!$GDIMG2_WIDTH) $GDIMG2_WIDTH = 240;
if (!$GDIMG2_HEIGHT) $GDIMG2_HEIGHT = 240;
$src_file = $img3_name;

//100&#49324;&#51060;&#51592; 
$tmp_src = explode(".",$src_file);
$tmp_src[0] = "gd_".$tmp_src[0];
$dst_file = join(".",$tmp_src);

//240 &#49324;&#51060;&#51592; 
$tmp_src = explode(".",$src_file);
$tmp_src[0] = "gd240_".$tmp_src[0];
$dst_file240 = join(".",$tmp_src);
if ($tmp_src[1] == "jpg" || $tmp_src[1] == "JPG")
{
(此处是399行) $src = imagecreatefromjpeg($home_url.$src_file); 
$dst = imagecreatetruecolor($GDIMG1_WIDTH, $GDIMG1_HEIGHT); //GD 2.0
$dst240 = imagecreatetruecolor($GDIMG2_WIDTH, $GDIMG2_HEIGHT); //GD 2.0
ImageColorAllocate($dst, 255, 255, 255); 
ImageColorAllocate($dst240, 255, 255, 255); 
imagecopyresampled($dst, $src, 0, 0, 0, 0, $GDIMG1_WIDTH, $GDIMG1_HEIGHT, imagesx($src), imagesy($src)); //GD 2.0 &#51060;&#49345; 
imagejpeg($dst, $home_url.$dst_file, 100); 
ImageDestroy($dst);
imagecopyresampled($dst240, $src, 0, 0, 0, 0, $GDIMG2_WIDTH, $GDIMG2_HEIGHT, imagesx($src), imagesy($src)); //GD 2.0 &#51060;&#49345; 
imagejpeg($dst240, $home_url.$dst_file240, 100); 
ImageDestroy($src); 
ImageDestroy($dst240); 
}
else if ($tmp_src[1] == "gif" || $tmp_src[1] == "GIF")
{
$src = ImageCreateFromGIF($home_url.$src_file); 
$dst = imagecreatetruecolor($GDIMG1_WIDTH, $GDIMG1_HEIGHT); //GD 2.0
$dst240 = imagecreatetruecolor($GDIMG2_WIDTH, $GDIMG2_HEIGHT); //GD 2.0
ImageColorAllocate($dst, 255, 255, 255); 
ImageColorAllocate($dst240, 255, 255, 255); 
imagecopyresampled($dst, $src, 0, 0, 0, 0, $GDIMG1_WIDTH, $GDIMG1_HEIGHT, imagesx($src), imagesy($src)); //GD 2.0 &#51060;&#49345; 
imagegif($dst, $home_url.$dst_file, 100); 
imagecopyresampled($dst240, $src, 0, 0, 0, 0, $GDIMG2_WIDTH, $GDIMG2_HEIGHT, imagesx($src), imagesy($src)); //GD 2.0 &#51060;&#49345; 
imagegif($dst240, $home_url.$dst_file240, 100); 
ImageDestroy($src); 
ImageDestroy($dst); 
ImageDestroy($dst240); 
}
$qry ="UPDATE goods SET img1='$dst_file',img2='$dst_file240' WHERE code='$code'";
$MySQL->query($qry);
}
}
ReFresh("total_goods_list.php?code=$category&write_code=$category"); ////write_code &#45716; &#49345;&#54408;&#46321;&#47197;&#54980; &#47785;&#47197;&#51060;&#46041;&#49884; &#49345;&#54408;&#52852;&#53580;&#44256;&#47532; &#51088;&#46041;&#49440;&#53469;&#51012; &#50948;&#54644; 
}
else
{
imgalldel();
echo "$qry";
}
?> 
           

注:页面注释是韩文的,不是乱码。

请高手帮忙。谢谢!
 
 1#楼  
 
  回复人:一起PHP
  注册时间:2004-02-27
  主题/回复:247/1521
  积分:4649
  等级:★★★★★☆(十一级)
  称号:论坛圣人

   
 1#楼 发表于2008-03-19 09:22:29  评分:1 

回复给楼主(mznflee)
...生成缩略图有这么复杂嘛????

看这错误提示,不象是代码的错误.
Warning:imagecreatefromjpeg()pen_basedir restriction in effect,file(/upload/goods/c21242.jpg)is not within the allowed path(s):

提示说好几个函数功能限制,文件 /upload/goods/xxx 不在允许的路径中. 
允许的路径有:(d:/hosting/wwwroot/;d:/hosting/system/;c:/windows/temp)

不过这是些warnning ,有可能不影响程序执行结果. 在函数前加 @ 或用error_reporting()关闭掉warnning提示,看是否能运行出效果.
  页数1/1首页 « 1 » 末页
  发表回复:您还没有登陆,无法发表回复。请先[登陆]

一起PHP技术联盟 主办:一起PHP 联系方式:站长QQ:4304410 QQ群:8423742 20159565 站长博客 E-mail: nqp@nqp.me 执行时间:0.047sec
SimsmaBBS 2008 (v6.0) Developed by 17php.com,Copyright(C)2003-2010 All rights reserved. 副本授权:一起PHP官方专用版