using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string filename = FileUpload1.FileName;
string nowpath = Server.MapPath(".") + "\\";
filename = nowpath + filename;
//
FileUpload1.SaveAs(filename);
System.Drawing.Image image, newimage, syimage;
System.Drawing.Image.GetThumbnailImageAbort callb = null;
image = System.Drawing.Image.FromFile(filename);
syimage = System.Drawing.Image.FromFile(Server.MapPath(".") + "\\" + " .gif");// " .gif" , :http://www.baidu.com/img/baidu.gif
//
newimage = image.GetThumbnailImage(100, 100, callb, new IntPtr());
newimage.Save(filename + ". .png");
newimage.Dispose();
//
Graphics g = Graphics.FromImage(image);
Font f = new Font(" ", 16);
Brush b = new SolidBrush(ColorTranslator.FromHtml("#FF0000"));
string addText = " ";
g.DrawString(addText, f, b, 10, 10);
g.DrawImageUnscaled(syimage, 50, 50);
//g.DrawImage(newimage,50,50,100,100);
g.Dispose();
//
image.Save(filename + ". .png");
image.Dispose();
syimage.Dispose();
Image1.ImageUrl = FileUpload1.FileName;
Image2.ImageUrl = FileUpload1.FileName + ". .png";
Image3.ImageUrl = FileUpload1.FileName + ". .png";
}
}