protected string ReplaceImageSource(string body) { List <string> imgSrc = AppEnv.GetSrc(body); foreach (var item in imgSrc) { string tem = item.Replace("http://media.xzone.vn:9002/", ""); if (tem.IndexOf("http://") > -1) { Match match = Regex.Match(body, "<img.*?src=\"" + item + "\".*?>", RegexOptions.RightToLeft); if (match.Success) { string olgImg = match.Value.Substring(0, match.Value.IndexOf('>') + 1); body = body.Replace(olgImg, "<div style=\"text-align:center;\"><img src=\"" + item + "\" width=\"300px;\"/></div>"); } else { body = body.Replace(item, item + "\" width=\"300px;\""); } } else { string newSrc = AppEnv.GetAvatarWaterMark(tem, ConvertUtility.ToInt32(width)); Match match = Regex.Match(body, "<img.*?src=\"" + item + "\".*?>", RegexOptions.RightToLeft); if (match.Success) { string olgImg = match.Value.Substring(0, match.Value.IndexOf('>') + 1); body = body.Replace(olgImg, "<div style=\"text-align:center;\"><img width=\"310px\" src=\"" + newSrc + "\"/></div>"); } } } string temp = ReplaceLinkRelateNew(body).Replace("font-size: small;", ""); return(temp); }