Wednesday, September 24, 2008

thumbnail generation code vb.net

Public Class Thumbnail
Dim OrgImgObj, Thumb As Drawing.Image
Public Function Create(ByVal ImgFolderPath As String, ByVal ThumbFolderPath As String, ByVal ImgSrcName As String, ByVal ThumbWidth As Int32, ByVal ThumbHeight As Int32) As Boolean

Try
OrgImgObj = OrgImgObj.FromFile(ImgFolderPath & "\" & ImgSrcName)
Thumb = OrgImgObj.GetThumbnailImage(ThumbWidth, ThumbHeight, Nothing, New IntPtr())
Thumb.Save(ThumbFolderPath & "\" & ImgSrcName, System.Drawing.Imaging.ImageFormat.Jpeg)
Return True
Catch Ex As Exception
Return False
End Try
End Function
End Class

No comments: