public static GenFuConfigurator <T> AsPlaceholderImage <T>(this GenFuStringConfigurator <T> configurator,
                                                                   int width, int height,
                                                                   string text            = null,
                                                                   string backgroundColor = null,
                                                                   string textColor       = null,
                                                                   ImgFormat format       = ImgFormat.GIF) where T : new()
        {
            CustomFiller <string> filler = new CustomFiller <string>(configurator.PropertyInfo.Name, typeof(T),
                                                                     () => PlaceholditUrlBuilder.UrlFor(width, height, text, backgroundColor, textColor, format));

            configurator.Maggie.RegisterFiller(filler);
            return(configurator);
        }
Exemple #2
0
        public static WireframeGenerator Image(this WireframeGenerator gen,
                                               int width,
                                               int height,
                                               string text            = null,
                                               string backgroundColor = null,
                                               string textColor       = null,
                                               object htmlAttributes  = null,
                                               ImgFormat format       = ImgFormat.GIF)
        {
            var img = new TagBuilder("img");

            img.TagRenderMode = TagRenderMode.SelfClosing;
            img.Attributes.Add("src", PlaceholditUrlBuilder.UrlFor(width, height, text, backgroundColor, textColor));
            img.MergeAttributes(HtmlAttributeHelper.GetHtmlAttributeDictionaryOrNull(htmlAttributes));
            return(gen.Add(img));
        }