【发布时间】:2012-09-18 12:03:49
【问题描述】:
我创建了一个bitmap,我想将它保存在我的upload 文件夹中。我怎样才能做到这一点?
我的代码:
public FileResult image(string image)
{
var bitMapImage = new Bitmap(Server.MapPath("/Content/themes/base/images/photo.png"));
Graphics graphicImage = Graphics.FromImage(bitMapImage);
graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
graphicImage.DrawString(image, new Font("Trebuchet MS,Trebuchet,Arial,sans-serif", 10, FontStyle.Bold), SystemBrushes.WindowFrame, new Point(15, 5));
graphicImage.DrawArc(new Pen(Color.Red, 3), 90, 235, 150, 50, 0, 360);
MemoryStream str = new MemoryStream();
bitMapImage.Save(str, ImageFormat.Png);
return File(str.ToArray(), "image/png");
}
我将使用的路径:
string mynewpath = Request.PhysicalApplicationPath + "Upload\\";
【问题讨论】:
-
我想将我在代码中创建的图像保存在上传文件夹中
-
这不是问题,这是要求。你有错误吗?它编译吗?等等...是个问题。
标签: c# asp.net-mvc asp.net-mvc-3 c#-4.0