本文實(shí)例講述了ASP.NET創(chuàng)建動(dòng)態(tài)縮略圖的方法。分享給大家供大家參考。具體分析如下:
提示:
1. 導(dǎo)入 System.IO
2. 創(chuàng)建 類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
希望本文所述對(duì)大家的asp.net程序設(shè)計(jì)有所幫助。
您可能感興趣的文章:- asp.net生成縮略圖示例方法分享
- asp.net中生成縮略圖并添加版權(quán)實(shí)例代碼
- asp.net生成縮略圖實(shí)現(xiàn)代碼
- asp.net文件上傳功能(單文件,多文件,自定義生成縮略圖,水印)
- asp.net 生成縮略圖代碼
- asp.net 上傳圖片并同時(shí)生成縮略圖的代碼
- asp.net 點(diǎn)縮略圖彈出隨圖片大小自動(dòng)調(diào)整的頁(yè)面
- ASP.Net 上傳圖片并生成高清晰縮略圖
- asp.net生成高質(zhì)量縮略圖通用函數(shù)(c#代碼),支持多種生成方式
- ASP.NET中高質(zhì)量縮略圖的生成代碼
- asp.net圖片上傳生成縮略圖的注意事項(xiàng)
- ASP.NET實(shí)現(xiàn)根據(jù)URL生成網(wǎng)頁(yè)縮略圖的方法