All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
ASP.NET实例:手把手教你如何扩展GridView之自带CheckBox_[Asp.Net教程]
一个典型的PHP分页实例代码_[PHP教程]
提高网页的用户体验:字体大小的设计_[Html教程]
EditPlus+NAnt构建轻巧的.NET开发环境_[Asp.Net教程]
用php或js获取图片大小,高宽尺寸_[PHP教程]
visual c++中基于对话框的应用程序
如何在十天学内会php之第三天_php资料_编程技术
事半功倍之javascript(3)_JavaScript技术_编程技术
delphi类的多态性
三个SQL视图查出所有SQL Server数据库字典_[SQL Server教程]
Reading number is top 10 pictures
NeedWallpaper4
NeedWallpaper6
Very beautiful interior decoration
人美胸美腿更美1
The money of more than 100 countries and regions3
某某人向找小三的人宣战了
Female model behind the bitterness, often being overcharged2
每天进步一点点
这只猪到底犯了什么错?
Ashlynn Brooke a group sexy photo1
Download software ranking
asp.netWeb服务器高级编程
DreamWeaver8
Call Of Duty5
Unix video tutorial2
asp.net技术内幕
Call Of Duty2
Tram sex maniac 2 (H) rar bag2
Rio big adventure
天龙八部最新服务端
Professional killers2 for Android
delv published in(发表于) 2014/1/6 9:03:38 Edit(编辑)
ASP.Net常用功能整理——生成图片的缩略图_[Asp.Net教程]

ASP.Net常用功能整理——生成图片的缩略图_[Asp.Net教程]

ASP.Net常用功能整理--生成图片的缩略图_[Asp.Net教程]

这二天想了想决定把自己先前做的项目中的小的功能,整理一下,奉献大家!经大家提议,我决定加上源代码,但是源代码不一定都是我写的,有的来自书上,有的来自网上,有的来自开源项目,与我自己的代码有不相符的,那就是先前的例子!


源代码:点击这里下载源代码


以下是上传一张800*1000的,分别生成不同缩略图


命名空间:


using System.IO;


核心代码:


System.Drawing.Image.GetThumbnailImageAbort callb = null;


try
{
// 保存到指定的文件夹
File1.PostedFile.SaveAs(Server.MapPath("/semir/ImgSides/") + sidePath);
MyImage = System.Drawing.Image.FromFile(Server.MapPath("/semir/ImgSides/") + sidePath);
// 保存大图(原图)
NewImage = MyImage.GetThumbnailImage(800, 1000, callb, new System.IntPtr());
NewImage.Save(Server.MapPath("/semir/ImgSides/") + "big" + sidePath);
// 保存中图
NewImage = MyImage.GetThumbnailImage(400, 500, callb, new System.IntPtr());
NewImage.Save(Server.MapPath("/semir/ImgSides/") + "middle" + sidePath);

// 单款衣服的图片大小
NewImage = MyImage.GetThumbnailImage(255, 319, callb, new System.IntPtr());
NewImage.Save(Server.MapPath("/semir/ImgSides/") + "SingleImage" + sidePath);

// 保存小图
NewImage = MyImage.GetThumbnailImage(115, 144, callb, new System.IntPtr());
NewImage.Save(Server.MapPath("/semir/ImgSides/") + "small" + sidePath);
// 保存极小图
NewImage = MyImage.GetThumbnailImage(45, 56, callb, new System.IntPtr());
NewImage.Save(Server.MapPath("/semir/ImgSides/") + "dinky" + sidePath);


MyImage.Dispose();
NewImage.Dispose();
// 一定要释放,否则进程被占用
}
catch(Exception ex)
{
Response.Write(ex.ToString());
}


来源:网学教学网







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.