SetVar($imgsrc,"file");if($width>$bw){$cm->BackFill($imgsrc,$bw,$bgv);} imageWaterMark($imgsrc,websypos,"../img/shuiyin.png","","","","",0,0); if($sw>$width){$sw=$width;}if($sh>$height){$sh=$height;} if(empty($rowcontrol[picys])){$cm->Cut("../".$targetFolder.$mbh."-1.jpg",$sw,$sh);}else{$cm->BackFill("../".$targetFolder.$mbh."-1.jpg",$sw,$sh);} if($zw>$width){$zw=$width;}if($zh>$height){$zh=$height;} if(empty($rowcontrol[picys])){$cm->Cut("../".$targetFolder.$mbh."-2.jpg",$zw,$zh);}else{$cm->BackFill("../".$targetFolder.$mbh."-2.jpg",$zw,$zh);} $wjv=$targetFolder.$mbh.".jpg"; $nxh=returnxh("yjcode_tp"," and bh='".$bh."'"); //OSSB if(check_in("a2a",$rowcontrol[aliosskg])){ $upty=1; include('../config/alioss/Common.php'); $bucket = Common::getBucketName(); $ossClient = Common::getOssClient(); if(!is_null($ossClient)){; $ossClient->setTimeout(3600); $ossClient->setConnectTimeout(3600); $ossClient->createObjectDir($bucket, $targetFolder); $ossClient->uploadFile($bucket,$targetFolder.$mbh.".jpg",$targetFile); $ossClient->uploadFile($bucket,$targetFolder.$mbh."-1.jpg","../".$targetFolder.$mbh."-1.jpg"); $ossClient->uploadFile($bucket,$targetFolder.$mbh."-2.jpg","../".$targetFolder.$mbh."-2.jpg"); delFile($targetFile); delFile("../".$targetFolder.$mbh."-1.jpg"); delFile("../".$targetFolder.$mbh."-2.jpg"); $alioss=preg_split("/,/",$rowcontrol[alioss]); $wjv="https://".$alioss[3].".".$alioss[2]."/".$targetFolder.$mbh.".jpg"; } } //OSSE intotable("yjcode_tp","bh,tp,type1,sj,userid,xh,upty","'".$bh."','".$wjv."','商品','".$sj."',".$row1[userid].",".$nxh.",".intval($upty).""); } } } }elseif($admin==6){ //资讯 if(!strstr($adminqx,",0,") && !strstr($adminqx,",0201,")){Audit_alert("权限不够","default.php");} while1("*","yjcode_news where bh='".$bh."'");if(!$row1=mysql_fetch_array($res1)){Audit_alert("来源错误","./","parent.");} createDir("../upload/news/".dateYMDN($row1[sj])."/"); $targetFolder="upload/news/".dateYMDN($row1[sj])."/".$bh."/"; createDir("../".$targetFolder); $total = count($_FILES['inp1']['tmp_name']); for($k=0; $k<$total; $k++) { if(returncount("yjcode_tp where bh='".$bh."'")<1){ if(is_uploaded_file($_FILES['inp1']['tmp_name'][$k])){ $sj=date("Y-m-d H:i:s"); $mbh=str_replace(" ","",microtime()."tp".$row1[userid]); $mbh=str_replace(".","",$mbh); $targetFile = "../".$targetFolder.$mbh.".jpg"; move_uploaded_file($_FILES['inp1']['tmp_name'][$k],$targetFile); $cm=new CreatMiniature(); $bw=600;$bg=500;$sw=200;$sh=160; $imgsrc="../".$targetFolder.$mbh.".jpg"; list($width, $height) = getimagesize(weburl.$targetFolder.$mbh.".jpg");$bgv=intval($height/($width/$bw)); $cm->SetVar($imgsrc,"file");if($width>$bw){$cm->Cut($imgsrc,$bw,$bgv);} imageWaterMark($imgsrc,websypos,"../img/shuiyin.png","","","","",0,0); if($width>$sw){$cm->Cut("../".$targetFolder.$mbh."-1.jpg",$sw,$sh);}else{copy($imgsrc,"../".$targetFolder.$mbh."-1.jpg");} $wjv=$targetFolder.$mbh.".jpg"; $nxh=returnxh("yjcode_tp"," and bh='".$bh."'"); intotable("yjcode_tp","bh,tp,type1,iffm,sj,userid,xh","'".$bh."','".$wjv."','资讯',1,'".$sj."',".returnjgdw($row1[userid],"",0).",".$nxh.""); } } } }elseif($admin==7){ //服务 if(!strstr($adminqx,",0,") && !strstr($adminqx,",0101,")){Audit_alert("权限不够","default.php");} while1("*","yjcode_server where bh='".$bh."'");if(!$row1=mysql_fetch_array($res1)){Audit_alert("来源错误","./","parent.");} $targetFolder = "upload/".$row1[userid]."/".$bh."/"; createDir("../".$targetFolder); $total = count($_FILES['inp1']['tmp_name']); for($k=0; $k<$total; $k++) { if(returncount("yjcode_tp where bh='".$bh."'")<7){ if(is_uploaded_file($_FILES['inp1']['tmp_name'][$k])){ $sj=date("Y-m-d H:i:s"); $mbh=str_replace(" ","",microtime()."tp".$row1[userid]); $mbh=str_replace(".","",$mbh); $targetFile = "../".$targetFolder.$mbh.".jpg"; move_uploaded_file($_FILES['inp1']['tmp_name'][$k],$targetFile); $cm=new CreatMiniature(); $bw=800;$bg=0;$sw=300;$sh=200; $imgsrc="../".$targetFolder.$mbh.".jpg"; list($width, $height) = getimagesize(weburl.$targetFolder.$mbh.".jpg");$bgv=intval($height/($width/$bw)); $cm->SetVar($imgsrc,"file");if($width>$bw){$cm->BackFill($imgsrc,$bw,$bgv);} imageWaterMark($imgsrc,websypos,"../img/shuiyin.png","","","","",0,0); if($sw>$width){$sw=$width;}if($sh>$height){$sh=$height;} if(empty($rowcontrol[picys])){$cm->Cut("../".$targetFolder.$mbh."-1.jpg",$sw,$sh);}else{$cm->BackFill("../".$targetFolder.$mbh."-1.jpg",$sw,$sh);} $wjv=$targetFolder.$mbh.".jpg"; $nxh=returnxh("yjcode_tp"," and bh='".$bh."'"); intotable("yjcode_tp","bh,tp,type1,sj,userid,xh,upty","'".$bh."','".$wjv."','服务','".$sj."',".$row1[userid].",".$nxh.",".intval($upty).""); } } } } php_toheader("tpupload.php?bh=".$bh."&admin=".$admin."&t=suc"); } ?> 图片上传
选择图片上传