帝国CMS程序安装头像裁切插件,帝国CMS怎么实现头像裁切功能(15)

string tempPath = "";
tempPath = "~/ImgCut/TempImages/";
savepath = context.Server.MapPath(tempPath);//实际保存文件夹路径
string filename = postedFile.FileName;
string sExtension = filename.Substring(filename.LastIndexOf('.'));
if (sExtension == ".jpg" || sExtension == ".jpeg" || sExtension == ".png" || sExtension == ".bmp")
{
if (!Directory.Exists(savepath))
{
Directory.CreateDirectory(savepath);
}
string sNewFileName = DateTime.Now.ToString("yyyyMMddhhmmssfff");
savepath = savepath + "/" + sNewFileName + sExtension;
postedFile.SaveAs(savepath);
System.Drawing.Image img = new System.Drawing.Bitmap(savepath);
tags: