添加水印的代码 测试 调试 结果 经过本人亲自测试
2010-03-23 15:14
495 查看
加水印的功能代码如下所示
代码 protected void Button1_Click(object sender, EventArgs e)
{
string extension = Path.GetExtension(this.FileUpload1.FileName).ToUpper();
string fileName = Guid.NewGuid().ToString();
string savePath = Server.MapPath("../upfile/" + fileName+ extension);
if (!Directory.Exists(Path.GetDirectoryName(savePath)))
{
Directory.CreateDirectory(Path.GetDirectoryName(savePath));
}
this.FileUpload1.SaveAs(savePath);
//实例化类
picmark wm = new picmark();
wm.DrawedImagePath = Server.MapPath("/upfile/" + "backlogo.gif") ;
wm.ModifyImagePath = savePath;
wm.RightSpace = 145;
wm.BottoamSpace =17;
wm.LucencyPercent = 50;
wm.OutPath = Server.MapPath("/upfile/" + fileName.Replace("-","").ToUpper() + extension);
wm.DrawImage();
//fileName = "_New_" + fileName;
//string sPath = Server.MapPath("../upfile/" + fileName + extension);
//this.FileUpload1.SaveAs(sPath);
//保存加水印过后的图片,删除原始图片
if (File.Exists(savePath))
{
File.Delete(savePath);
//File.Delete(wm.OutPath);
}
代码 protected void Button1_Click(object sender, EventArgs e)
{
string extension = Path.GetExtension(this.FileUpload1.FileName).ToUpper();
string fileName = Guid.NewGuid().ToString();
string savePath = Server.MapPath("../upfile/" + fileName+ extension);
if (!Directory.Exists(Path.GetDirectoryName(savePath)))
{
Directory.CreateDirectory(Path.GetDirectoryName(savePath));
}
this.FileUpload1.SaveAs(savePath);
//实例化类
picmark wm = new picmark();
wm.DrawedImagePath = Server.MapPath("/upfile/" + "backlogo.gif") ;
wm.ModifyImagePath = savePath;
wm.RightSpace = 145;
wm.BottoamSpace =17;
wm.LucencyPercent = 50;
wm.OutPath = Server.MapPath("/upfile/" + fileName.Replace("-","").ToUpper() + extension);
wm.DrawImage();
//fileName = "_New_" + fileName;
//string sPath = Server.MapPath("../upfile/" + fileName + extension);
//this.FileUpload1.SaveAs(sPath);
//保存加水印过后的图片,删除原始图片
if (File.Exists(savePath))
{
File.Delete(savePath);
//File.Delete(wm.OutPath);
}
相关文章推荐
- JDK1.7新特性(经过本人测试的结果)
- asp.net 添加水印的代码(已测试)
- [资源分享] (转载)Xcode 3.2.5免证书开发调试(经过本人测试xcode4.0使用)
- java备份还原mysql数据库(源码经过本人亲自测试通过)
- java备份还原mysql数据库(源码经过本人亲自测试通过)
- asp.net 添加水印的代码(已测试)
- 调用“页面设置”标准对话框并对当前的打印机进行设定的代码,经过多次调试,总算出结果了
- (待补全测试结果)crm小问题注意:add.jsp添加客户页面回显字典供选择。【查询字典时传参数typeCode不能和属性名相同】
- iOS添加测试设备与调试
- “三天打渔,两天晒网”程序说明(算法流程图)及调试与测试结果
- 给Office文档添加水印效果【测试有效】
- HTML转PDF(java版,经过测试好用,可以先用简单的html调试)
- ffmpeg 0.6.3 代码, 经过我努力,能够在vs 2005 下单步调试代码
- aspjpeg 添加PNG水印 最简洁代码
- 代码测试之代码调试
- 添加浮动按钮点击滚动到网页底部的纯JavaScript演示代码 IE9、11,Maxthon 1.6.7,Firefox30、31,360极速浏览器7.5.3.308下测试正常
- VB2008控件数组全解(绝对经典,代码为本人自行设计并调试运行成功~~)
- STC12C5620AD系列单片机EEPROM/IAP 功能测试程序(官方改良版,增加串口监控功能,本人亲自测试通过)
- 中文分词笔记之三:示例代码及测试结果
- XCode调试的 Stack Trace,调试时抛出异常,定位到某一行代码,并且添加变量监视