asp.net生成缩略图
2004-08-16 01:37
302 查看
当我们要上传图片的时候,往往需要生成缩略图,以往我们要使用第三方控件才能完成。在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>
<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生成缩略图
- 使用ASP.NET Image Generation生成图片缩略图及水印
- asp.net上传图片并同时生成缩略图
- asp.net上传功能(单文件,多文件,自定义生成缩略图,水印)
- asp.net生成高质量缩略图通用函数(c#代码
- 『ASP.NET 2.0』FileUpload图片上传自动生成缩略图
- ASP.NET生成缩略图的代码
- asp.net生成高清晰缩略图
- asp.net生成高质量缩略图通用函数(c#代码),支持多种生成方式
- 使用ASP.NET Image Generation生成图片缩略图及水印
- ASP.NET 上传图片并生成缩略图
- 在ASP.NET中上传图片并生成缩略图
- 在ASP.NET中上传图片并生成缩略图
- 在ASP.NET中上传图片并生成缩略图的C#源码
- ASP.NET C# 按原图片大小等比例缩放生成缩略图
- 在ASP.NET中上传图片并生成缩略图的C#源码
- ASP.NET中生成缩略图的代码
- ASP.NET 不经保存,直接生成上传图片的等比例的高质量缩略图
- 在ASP.NET中上传图片并生成缩略图
- [翻译]Asp.net生成高质量缩略图