静态方法里可以调用类吗?
各位大侠,我在研究一个上传多个图片加水印的功能,现在上传多个文件已经成功了,用的是uploadify,他在后台只有一个方法,我想在这里面写,关于给图片增加水印的功能代码如下:
[System.Web.Services.WebMethod] public static void GetSound(string aa, string type) { try { string webFilePath = ""; string webFilePath_sy = ""; AddWater(webFilePath, webFilePath_sy); } catch { } }
/// <summary> /// 在图片上增加文字水印 /// </summary> /// <param name="Path">原服务器图片路径</param> /// <param name="Path_sy">生成的带文字水印的图片路径</param> public void AddWater(string Path, string Path_sy) { string addText = "111111111111111111111"; System.Drawing.Image image = System.Drawing.Image.FromFile(Path); System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image); g.DrawImage(image, 0, 0, image.Width, image.Height); System.Drawing.Font f = new System.Drawing.Font("Verdana", 60); System.Drawing.Brush b = new System.Drawing.SolidBrush(System.Drawing.Color.Green); g.DrawString(addText, f, b, 35, 35); g.Dispose(); image.Save(Path_sy); image.Dispose(); }