用c++进行图片编码后依然可以用此方法解码,
/// <summary>
/// base64的编码的图片解码/// </summary>
/// <param name="streamByte"></param>
/// <returns></returns>
public static string ReturnPhoto(byte[] streamByte, decimal zid, decimal mid)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream(streamByte);
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
string datetime = DateTime.Now.ToFileTime().ToString();//AppDomain.CurrentDomain.SetupInformation.ApplicationBase+"/"+
string SaveImgName = datetime + "-" + zid + "-" + mid + ".jpg";
img.Save(path + SaveImgName, System.Drawing.Imaging.ImageFormat.Jpeg);
return "../upload/" + SaveImgName;
}
其中,path是在webconfig里设置的图片保存路径