当我们要上传图片的时候,往往需要生成缩略图,以往我们要使用第三方控件才能完成。在asp.net中用下面方法轻松搞定 <script language="vb" runat="server"> 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
'生成缩略图 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