When we want to upload pictures, it often needs to generate thumbnails, and we have to use third-party controls to complete. Use the following method to easily get it in ASP.NET
SUB Page_Load (Sender As Object, E as Eventargs)
DIM image, AnewImage as system.drawing.image
Dim Width, Height, NewWidth, NewHeight AS Integer
DIM Callb as system.drawing.image.getthumbnailimageabort
'Generate thumbnails
Image = system.drawing.image.fromfile (Server.MAppath ("ClassPIC /" "rs1.jpg")))
Width = image.width
HEIGHT = image.height
IF Width> Height Then
NewWidth = 110
NEWHEIGHT = Image.Height / Image.width * NewWidth
Else
NEWHEIGHT = 110
NewWidth = image.width / image.height * newheight
END IF
AnewImage = image.getthumbnailimage (NewWidth, NewHeight, Callb, New System.Intptr ())
ANEWIMAGE.SAVE (Server.MAppath ("SmallPic /" "RS1.GIF"))
image.dispose ()
End Sub
script>