Ejemplo n.º 1
0
        //private string pslug = string.Empty;
        //private string firstImageUrl;
        public string ExtractFirstImageUrl(IPost post, IUrlHelper urlHelper, string fallbackImageUrl = null)
        {
            return(_contentProcessor.ExtractFirstImageUrl(post, urlHelper, fallbackImageUrl));

            //if (urlHelper == null) return string.Empty;
            //if (post == null) return string.Empty;

            //var baseUrl = string.Concat(urlHelper.ActionContext.HttpContext.Request.Scheme,
            //            "://",
            //            urlHelper.ActionContext.HttpContext.Request.Host.ToUriComponent());

            //if (post.ContentType == "markdown")
            //{
            //    var mdImg = mdProcessor.ExtractFirstImageUrl(post.Content);
            //    if (!string.IsNullOrEmpty(mdImg))
            //    {
            //        if (mdImg.StartsWith("http")) return mdImg;

            //        return baseUrl + mdImg;
            //    }

            //    return string.Empty;
            //}

            //if (!string.IsNullOrWhiteSpace(firstImageUrl) && pslug == post.Slug)
            //{
            //    if (firstImageUrl.StartsWith("http")) return firstImageUrl;

            //    return baseUrl + firstImageUrl; //don't extract it more than once
            //}

            //if (post == null) return string.Empty;


            //firstImageUrl = filter.ExtractFirstImageUrl(post.Content);
            //pslug = post.Slug;

            //if (firstImageUrl == null) return fallbackImageUrl;

            //if (firstImageUrl.StartsWith("http")) return firstImageUrl;



            //return baseUrl + firstImageUrl;
        }
 public string ExtractFirstImageUrl(IPost post, IUrlHelper urlHelper, string fallbackImageUrl = null)
 {
     return(_contentProcessor.ExtractFirstImageUrl(post, urlHelper, fallbackImageUrl));
 }