<?php
	header("Cache-Control: no-cache, must-revalidate");
	header("Pragma: no-cache");

	if (isset($_POST["PHPSESSID"])) {
		session_id($_POST["PHPSESSID"]);
	}

	$conf_basedir = "./"; //相对主目录的位置
	$conf_where = "admin"; //选择调用相应模块
	include_once($conf_basedir . "/base.inc.php");

	if (!isset($_FILES["Filedata"]) || !is_uploaded_file($_FILES["Filedata"]["tmp_name"]) || $_FILES["Filedata"]["error"] != 0) {
		echo "There was a problem with the upload";
		exit(0);
	} else {
		$uf = new UploadFile("Filedata");
		$uf->setFileType("jpg|png");
		$uf->setMaxSize("5120");
		$uf->setUploadType("ftp");
		$uf->setSaveDir("/njhouse/");
		//$uf->setWatermark(true);
		//$uf->setWatermarkType(1);
		//$uf->setWatermarkPosition("rb");
		//$uf->setWatermarkString("HOUSE365.COM");

        $uf->setWatermark(false);//是否添加水印（默认false）
	    $uf->setWatermarkType(2);//添加水印类型(1为文字,2为图片)（默认1）
		$uf->setWatermarkPosition("cc");//水印位置 lt左上；lb左下；rt右上；rb右下；ct中上；cb中下；lc左中；rc右中；cc中间（默认rt）
		$uf->setWatermarkImage("http://esfadmin.house365.com/images/sy11.png");//水印字符串（默认HOUSE365.COM）

		$uf->setImageCut(true);
		$uf->setImageWidth(894);
		$uf->setImageHeight(671);

		$uf->setResizeImage(true);
		$uf->setResizeWidth(302);
		$uf->setResizeHeight(226);

        $uf->setBigshow(true);
        $uf->setBigshowWidth(600);
        //$uf->setBigshowCut(true);
        //$uf->setBigshowReality(false);
        //$uf->setBigshowNeedWater(true);

		if($uf->upload()=="success")
		{   //echo $uf->getBigshowURL();
			//$picurl =  $uf->getSaveFileURL();//图片地址
			$picurl =  $uf->getResizeImageURL();//缩略图片地址
		} else {
			 die("<script>alert('未知错误，文件上传失败！');</script>");
		}

		echo $picurl;
	}


?>