asp.net生成缩略图
2014-05-02 11:20
344 查看
asp.net生成缩略图
当我们要上传图片的时候,往往需要生成缩略图,以往我们要使用第三方控件才能完成。在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
aNewImage=image.GetThumbnailImage(newwidth,newheight,callb,new System.IntPtr())
aNewImage.Save(Server.MapPath("smallpic/"+"rs1.gif"))
image.Dispose()
End Sub
</script>
当我们要上传图片的时候,往往需要生成缩略图,以往我们要使用第三方控件才能完成。在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
aNewImage=image.GetThumbnailImage(newwidth,newheight,callb,new System.IntPtr())
aNewImage.Save(Server.MapPath("smallpic/"+"rs1.gif"))
image.Dispose()
End Sub
</script>
相关文章推荐
- asp.net生成高质量缩略图通用函数(c#代码
- 在ASP.NET中上传图片并生成缩略图
- asp.net 生成缩略图
- ASP.NET 生成缩略图(防失真)。
- asp.net 保存图片 生成缩略图
- [导入]用ASP.NET上传图片并生成带版权信息的缩略图
- asp.net生成缩略图
- asp.net上传图片并同时生成缩略图[转]
- Asp.net上传图片同时生成文字水印图,图片水印图,缩略图
- asp.net上传图片+自动生成缩略图+图片水印功能
- ASP.Net常用功能整理--生成图片的缩略图
- ASP.NET生成缩略图的代码
- asp.net上传图片并同时生成缩略图
- Asp.Net 高清图片缩略图生成
- 在ASP.NET中上传图片并生成缩略图的C#源码
- ASP.NET生成缩略图
- asp.net生成缩略图
- asp.net上传图片自动生成缩略图功能代码
- asp.net生成缩略图及给原始图加水印