例如:
- HTML code
<img src="smailImage.aspx">
- C# code
smailImage.aspx 输出
展示一个缩略图 怎么弄呢
------解决方案--------------------------------------------------------
smailImage.aspx里面
写
- C# code
protected void Page_Load(object sender, EventArgs e){ Response.ClearContent(); Response.ContentType = "images/jpeg"; Response.BinaryWrite(System.IO.File.ReadAllBytes(Server.MapPath("~/aaaa.jpg"))); Response.End();}
------解决方案--------------------------------------------------------
或者显示指定文件的缩略图
- C# code
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();}
------解决方案--------------------------------------------------------
------解决方案--------------------------------------------------------
http://hi.baidu.com/zhenghanzheng/blog/item/7e0ac7640fa27af7f63654bf
------解决方案--------------------------------------------------------
你先找一个把网页转成图片的程序,这种程序一般都是收费的,免费的好用的很难找
------解决方案--------------------------------------------------------
比如
http://www.websitesscreenshot.com/
------解决方案--------------------------------------------------------
给个思路,lz试下:
1,抓取到需要的网页
2.通过GDI+做成图片
------解决方案--------------------------------------------------------
http://download.csdn.net/detail/anzhiqiang_touzi/1069856