图片 base64转byte[]
/// <summary> /// 保存base64图片,返回阿里云地址 /// </summary> /// <param name="imgCode"></param> /// <returns></returns> private string SaveBase64Image(string imgCode) { string imgUrl = string.Empty; if (!string.IsNullOrEmpty(imgCode)) { Regex reg = new Regex(@"data:(image.+);base64,(.+)"); if (reg.IsMatch(imgCode)) { var matchs = reg.Match(imgCode); string contentType = matchs.Groups[1].Value; string base64Code = matchs.Groups[2].Value; string extendType = contentType.Replace("image/", ""); byte[] arr = Convert.FromBase64String(base64Code);//base64转byte[] //var picture = _pictureService.InsertPicture