///
/// This function convert data url to Image and return saved image path
///
///
public string Base64ToImage(string data)
{
string ret = "";
var base64Data = Regex.Match(data, @"data:image/(?
var binData = Convert.FromBase64String(base64Data);
using (var stream = new MemoryStream(binData))
{
using (Image img = new Bitmap(stream))
{
string basePath = Server.MapPath("~/UserFiles/PhotoPrint");
ret = Guid.NewGuid().ToString() + ".png";
img.Save(basePath + "\\" + ret, ImageFormat.Png);
}
}
return ret;
}