ASP.NET创建动态缩略图的方法
2015-06-16 00:00
736 查看
本文实例讲述了ASP.NET创建动态缩略图的方法。分享给大家供大家参考。具体分析如下:
提示:
1. 导入 System.IO
2. 创建 类C lass "CreateThumbnails"
or any class and place following function inside that class
You need one function to response call back to main function
Function ImageAbortDummyCallback() As Boolean
Return False
End Function
具体代码如下:
Function CreateJPEGThumbnail(ByVal inSourceFile As String, ByVal inDestinationFile As String, ByVal ThumbWidth As Integer, ByVal ThumbHeight As Integer) As Boolean Dim imageFile As System.Drawing.Image Dim outputFstream As New FileStream(inSourceFile, FileMode.Open, FileAccess.Read) 'Exposes a System.IO.Stream around a file, supporting both synchronous and asynchronous read and write operations. Dim ImageAbortCallBack As System.Drawing.Image.GetThumbnailImageAbort 'This method returns true if it decides that the System.Drawing.Image.GetThumbnailImage method should prematurely stop execution; otherwise, it returns false. imageFile = System.Drawing.Image.FromStream(outputFstream) ImageAbortCallBack = New System.Drawing.Image.GetThumbnailImageAbort(AddressOf ImageAbortDummyCallback) imageFile = imageFile.GetThumbnailImage(ThumbWidth, ThumbHeight, ImageAbortCallBack, IntPtr.Zero) 'IntPtr = A platform-specific type that is used to represent a pointer or a handle. imageFile.Save(inDestinationFile, System.Drawing.Imaging.ImageFormat.Jpeg) outputFstream.Close() outputFstream = Nothing imageFile = Nothing End Function
希望本文所述对大家的asp.net程序设计有所帮助。
相关文章推荐
- ASP.NET缓存处理类实例
- 浅谈ASP.NET中多层架构
- ASP.NET MVC导入excel到数据库
- ASP.NET中DataSet对象取值、行列数、列名总结
- ASP.NET Web API与Owin OAuth:调用与用户相关的Web API
- 母版页 VS shtml—ASP.NET细枝末节(3)
- 修改repeater控件里面某项的值
- Asp.Net防止刷新重复提交数据小记
- 利用Metasploit来攻击Mysql
- My career aspirations
- IIS上虚拟站点的web.config与主站点的web.config冲突解决方法 分类: ASP.NET 2015-06-15 14:07 59人阅读 评论(0) 收藏
- IIS上虚拟站点的web.config与主站点的web.config冲突解决方法 分类: ASP.NET 2015-06-15 14:07 60人阅读 评论(0) 收藏
- AspxGridView学习日记--动态添加超链接列
- 实验三:学生工作管理系统asp和asp.cs代码
- asp.net关于repeater嵌套repeater的方法
- asp.net下拉框部分不可选与分类显示
- 浅谈ASP.NET中MVC 4 的JS/CSS打包压缩功能
- Asp.Net Mvc: 应用BindAttribute
- asp.net mvc学习笔记1(razor,html,url辅助器,ViewData,ViewBag)
- Windows Server 2008 R2中的ASP.NET环境架设