我的一亩三分地 我就喜欢!
13fen  设为主页
 收藏本站
 
当前位置: > 一亩三分地:首页 > 网络学院 > 网络编程 > net专区 > 用ASP.Net生成缩略图
热门文章排行
热门文章排行 检查email地址格式的代码(01-11)
PHP操作文件问答(01-11)
PHP安装攻略:安装并配置PHP(10-23)
PHP的十个高级技巧 4(10-23)
关于APE的介绍、播放及制作(03-22)
精采文章排行
精采文章排行 ASP.NET与MySQL数据库简明图示入门教(11-16)
ASP.NET与MySQL数据库简明图示入门教(11-16)
ASP.NET 链接数据库基础(11-16)
webconfig的设置节点说明(11-16)
部署ASP.NET的三大技术(上)(11-16)
技术专题推荐
网管论坛交流
 

用ASP.Net生成缩略图 

作者:佚名   来源:Linux 宝库   点击:   日期:2006-12-22


  当我们要上传图片的时候,往往需要生成缩略图,以往我们要使用第三方控件才能完成。在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>





文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【论坛讨论

   相关文章:
·给你的FileSystemObject对象加把锁 ·在 Web 页上使用条件数值格式
·连接数据库查询手册(不仅仅适用于asp) ·警惕"给你的FileSystemObject对象加把锁"
·用ASP做全文检索 ·如何把ASP编写成DLL

   文章评论:(条)
  
 请留名: 匿名评论   点击查看所有评论 网管论坛
 

  责任编辑:一分  声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。