圖片水印
///控制器
/// <summary>
/// 圖片水印
/// </summary>
/// <param name="File1"></param>
/// <returns></returns>
public ActionResult shuiyinpost(HttpPostedFileBase File1)
{
string warning = "";
//獲取圖片的路徑
string files = Server.MapPath(File1.FileName);
string filename = files.Remove(files.LastIndexOf("\\") - 5) + "images\\" + File1.FileName;
string watchname = files.Remove(files.LastIndexOf("\\") - 5) + "images\\" + "004 (2).jpg";
File1.SaveAs(filename);
//添加水印
string WarkUrl = WatherHelper.makewatermark(filename, watchname, WaterType.Center, files.Remove(files.LastIndexOf("\\") - 5) + "images\\", ImageType.JPEG, FileCache.Delete, out warning);
return Content(WarkUrl);
}
///視圖
<form action="/Homes/shuiyinpost" enctype="multipart/form-data" method="post">
<input name="File1" type="file" /><input id="Button1" type="submit" value="提交" />
</form>
圖片水印