Ejemplo n.º 1
0
        protected override string GetProcessArguments(IIntegrationResult result)
        {
            ProcessArgumentBuilder processArgumentBuilder = new ProcessArgumentBuilder();

            if (!string.IsNullOrEmpty(Options.Trim()))
            {
                processArgumentBuilder.Append(Options.Trim());
            }
            processArgumentBuilder.AddArgument(Src.Trim());
            processArgumentBuilder.AddArgument(Dest.Trim());
            return(processArgumentBuilder.ToString());
        }
Ejemplo n.º 2
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            var url     = _config.Cdn + Src.Trim('/');
            var bareUrl = url.Substring(0, url.LastIndexOf('.'));

            if (!string.IsNullOrEmpty(Buster))
            {
                url += $"?v={Buster}";
            }

            output.TagName = "picture";

            foreach (var format in SourceFormats)
            {
                var fullUrl = $"{bareUrl}.{format}";
                output.Content.AppendHtml($@"<source type=""image/{format}"" srcset=""{fullUrl}"" />");
            }


            output.Content.AppendHtml(!Eager
                ? $@"<img src=""{url}"" alt=""{Alt}"" width=""{Width}"" height=""{Height}"">"
                : $@"<img src=""{url}"" alt=""{Alt}"" width=""{Width}"" height=""{Height}"" loading=""lazy"">");
        }