mkdir($destination_folder); }
$filename=$file["tmp_name"]; $image_size = getimagesize($filename); $pinfo=pathinfo($file["name"]); $ftype=$pinfo[''extension'']; $destination = $destination_folder.time().".".$ftype; if (file_exists($destination) && $overwrite != true) { echo "同名文件已经存在了"; exit; }
if(!move_uploaded_file ($filename, $destination)) { echo "移动文件出错"; exit; }
$pinfo=pathinfo($destination); $fname=$pinfo[basename]; echo " <font color=red>已经成功上传</font><br>文件名: <font color=blue>".$destination_folder.$fname."</font><br>"; echo " 宽度:".$image_size[0]; echo " 长度:".$image_size[1]; echo "<br> 大小:".$file["size"]." bytes";
if($watermark==1) { $iinfo=getimagesize($destination,$iinfo); $nimage=imagecreatetruecolor($image_size[0],$image_size[1]); $white=imagecolorallocate($nimage,255,255,255); $black=imagecolorallocate($nimage,0,0,0); $red=imagecolorallocate($nimage,255,0,0); imagefill($nimage,0,0,$white); switch ($iinfo[2]) { case 1: $simage =imagecreatefromgif($destination); break; case 2: $simage =imagecreatefromjpeg($destination); break; case 3: $simage =imagecreatefrompng($destination); break; case 6: $simage =imagecreatefromwbmp($destination); brea |