杜华瑾,为保名声不许求助,北京缓解拥堵
本文实例讲述了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程序设计有所帮助。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Net Core Web Api项目与在NginX下发布的方法
asp.net core3.1 引用的元包dll版本兼容性问题解决方案
IdentityServer4实现.Net Core API接口权限认证(快速入门)
ASP.NET Core MVC通过IViewLocationExpander扩展视图搜索路径的实现
网友评论