if ($_POST[formcheck]=='send') { //$linkstr=mysql_connect("lpsql01.lunariffic.com","piccool0_abc","12345678"); $error=""; function generate_id() { global $title, $description; $continue = true; //$auction_id = uniqid(""); $auction_id = md5(uniqid(rand())); //$auction_id = eregi_replace("[a-f]","",$auction_id); return $auction_id; } $attachdir="/media/BACKUP/html/2home/2home/phpAdsNew/"; $wwwchdir="http://pic.2home.com.tw/2home/phpAdsNew/"; $attach_subdir = date('ym'); $attach_descdir= $attachdir.$attach_subdir; $wwwch_descdir=$wwwchdir.$attach_subdir."/"; if(!is_dir($attach_descdir)) { @mkdir($attach_descdir, 0777); } $mainimage_m=""; for($arraycounter=1;$arraycounter<=11;$arraycounter++){ $auction_id = generate_id(); //--處理圖片修改問題 if($_FILES[userfile][tmp_name][$arraycounter]!="") { echo $arraycounter."."; $inf = GetImageSize($_FILES[userfile][tmp_name][$arraycounter]); $er = false; $MAX_UPLOAD_SIZE=500000; $image_upload_path= $attach_descdir."/"; // make a check //--------------------------------------------------------------- if($inf) { $inf[2] = intval($inf[2]); // check for uploaded file type if ( ($inf[2]!=1) && ($inf[2]!=2) ) { $er = true; $ERR = "圖片檔案格式必須是GIF 或 JPG"; } else { // check for file size if ( intval($userfile_size)>$MAX_UPLOAD_SIZE ) { $er = true; $ERR = "圖片超過預設大小,請重新設定圖片!!"; } } } else { $ERR = "ERR_060"; $er = true; } //------------------------------------------------------------------ //------------------------------------------------------------------ if (!$er) { // really save this file $ext = ($inf[2]==1)?".gif":".jpg"; $fname = $image_upload_path.$auction_id.$ext; $outthumb=$image_upload_path.$auction_id."_s".".jpg"; if (file_exists($fname)) unlink ($fname); copy($_FILES[userfile][tmp_name][$arraycounter], $fname); $defaultdept_pic = $auction_id.$ext; //轉小圖 $syscmd = "/usr/local/bin/convert -geometry 640x640 -quality 80 ".$fname." ".$fname; exec($syscmd); // $syscmd = "/usr/local/bin/convert text:myav"." ".$fname; // exec($syscmd); // if($ext==".jpg"){ // $src=imagecreatefromjpeg($fname);} // else // { $src=imagecreatefromgif($fname);} // $src_w=imagesx($src); // $src_h=imagesy($src); //if($src_w>640){ // if($src_w>$src_h){ // $thumb_w=640; // $thumb_h=intval($src_h / $src_w * 640); // }else{ // $thumb_h=640; // $thumb_w=intval($src_w / $src_h * 640); // }} // else // { $thumb_h=$src_h; // $thumb_w=$src_w;} // $thumb = imagecreatetruecolor($thumb_w,$thumb_h); // imagecopyresized($thumb,$src,0,0,0,0,$thumb_w,$thumb_h,$src_w,$src_h); // imagejpeg($thumb,$fname); } //-------------------------------------------------------------------- $qq=$qq."-[img]".$wwwch_descdir.$defaultdept_pic."[/img]"; $wwwfname=$attach_subdir."/".$defaultdept_pic; //$sqlstr="INSERT INTO 2homeuploadimages (uploadimages_id,uploadimages_forum,uploadimages_userid,uploadimages_username,uploadimages_thread,uploadimages_pic,uploadimages_date,uploadimages_ver) VALUES (NULL,'".$forum."','".$userid."','".$username."','".$threadid."','".$wwwfname."','".date("Y/m/d H:i:s",time()) ."','".$_SERVER[HTTP_USER_AGENT]."')"; //mysql_db_query("piccool0_upload",$sqlstr,$linkstr); } } $url_back = "http://www.2home.com.tw/bbs/uploadok2.php?abc=".$qq; $vg_message="您輸入資料己傳送出去了!"; include("go_back.php"); ?> } else { ?>