例如:  <img src="smailImage.aspx">
smailImage.aspx 输出展示一个缩略图 怎么弄呢

解决方案 »

  1.   

    本帖最后由 net_lover 于 2012-04-05 14:06:28 编辑
      

  2.   

    或者显示指定文件的缩略图protected void Page_Load(object sender, EventArgs e)
    {
      Response.ClearContent();
      Response.ContentType = "images/jpg";
      String file = Server.MapPath("~/aaaa.jpg"); //显示aaaa.jpg的缩略图
      System.Drawing.Image image = System.Drawing.Image.FromStream(new System.IO.MemoryStream(System.IO.File.ReadAllBytes(file)));
      int newWidth = 100, newHeight = 100;
      if ((decimal)image.Width / image.Height > (decimal)newWidth / newHeight)
      {
        newHeight = Convert.ToInt32((decimal)image.Height * newWidth / image.Width);
      }
      else if ((decimal)image.Width / image.Height < (decimal)newWidth / newHeight)
      {
        newWidth = Convert.ToInt32((decimal)image.Width * newHeight / image.Height);
      }
      System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(newWidth, newHeight);
      System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp);
      g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
      g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
      g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
      System.Drawing.Rectangle rectDestination = new System.Drawing.Rectangle(0, 0, newWidth, newHeight);
      g.DrawImage(image, rectDestination, 0, 0, image.Width, image.Height, System.Drawing.GraphicsUnit.Pixel);
      bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
      bmp.Dispose();
      image.Dispose();
      Response.End();
    }
      

  3.   

    如果是指定的页面 怎么弄呢。不是文件 例如:http://192.168.3.14/a.aspx 或者 http:www.baidu.com 这样的url 呢
      

  4.   

    http://hi.baidu.com/zhenghanzheng/blog/item/7e0ac7640fa27af7f63654bf.html
      

  5.   

    比如
    http://www.websitesscreenshot.com/
      

  6.   

    给个思路,lz试下:
    1,抓取到需要的网页
    2.通过GDI+做成图片
      

  7.   

    http://download.csdn.net/detail/anzhiqiang_touzi/1069856
      

  8.   

    已经写好了。可惜我页面用的jquery easy ui  布局  ajax 擦。 截出来的图片都是正在加载中..