private string AutoRemoteImageSave(string content)
        {
            if (string.IsNullOrEmpty(content))
            {
                return(string.Empty);
            }
            Web.UI.UpLoad   upload = new UI.UpLoad();
            Regex           reg    = new Regex("IMG[^>]*?src\\s*=\\s*(?:\"(?<1>[^\"]*)\"|'(?<1>[^\']*)')", RegexOptions.IgnoreCase);
            MatchCollection m      = reg.Matches(content);

            foreach (Match math in m)
            {
                string imgUri = math.Groups[1].Value;
                if (imgUri.StartsWith("http"))
                {
                    string newImgPath = upload.remoteSaveAs(imgUri);
                    if (newImgPath != string.Empty)
                    {
                        content = content.Replace(imgUri, newImgPath);
                    }
                }
            }
            return(content);
        }
Esempio n. 2
0
 private string AutoRemoteImageSave(string content)
 {
     if (string.IsNullOrEmpty(content))
     {
         return string.Empty;
     }
     Web.UI.UpLoad upload = new UI.UpLoad();
     Regex reg = new Regex("IMG[^>]*?src\\s*=\\s*(?:\"(?<1>[^\"]*)\"|'(?<1>[^\']*)')", RegexOptions.IgnoreCase);
     MatchCollection m = reg.Matches(content);
     foreach (Match math in m)
     {
         string imgUri = math.Groups[1].Value;
         if (imgUri.StartsWith("http"))
         {
             string newImgPath = upload.remoteSaveAs(imgUri);
             if (newImgPath != string.Empty)
             {
                 content = content.Replace(imgUri, newImgPath);
             }
         }
     }
     return content;
 }