'Éú³ÉËõÂÔͼ
Protected Shared Function SaveThumbnail(ByVal fromfile As String)
Dim image, anewimage As System.Drawing.Image
Dim width, height, newwidth, newheight As Integer
Dim callb As System.Drawing.Image.GetThumbnailImageAbort
Dim SmallFileFullName As String
Dim filepath As String
filepath = Path.GetDirectoryName(fromfile)
Dim FileName As String
FileName = Path.GetFileName(fromfile)
image = System.Drawing.Image.FromFile(fromfile)
width = image.Width
height = image.Height
If width > height Then
newwidth = 100
newheight = image.Height / image.Width * newwidth
Else
newheight = 100
newwidth = image.Width / image.Height * newheight
End If
anewimage = image.GetThumbnailImage(newwidth, newheight, callb, New System.IntPtr)
Dim smallphotopath As String = filepath + "\smallphoto\"
If Not Directory.Exists(smallphotopath) Then
Directory.CreateDirectory(smallphotopath)
End If
SmallFileFullName = smallphotopath + FileName
anewimage.Save(SmallFileFullName)
image.Dispose()
End Function