/// <summary> /// Renders HTML for an image /// </summary> /// <param name="image">The image to render</param> /// <param name="attributes">Additional attributes to add. Do not include alt or src</param> /// <returns>An img HTML element</returns> public string RenderImage(FieldTypes.Image image, NameValueCollection attributes) { if (image == null) { return(""); } if (attributes == null) { attributes = new NameValueCollection(); } string format = "<img src='{0}' {1}/>"; //should there be some warning about these removals? AttributeCheck(attributes, "class", image.Class); AttributeCheck(attributes, "alt", image.Alt); if (image.Height > 0) { AttributeCheck(attributes, "height", image.Height.ToString()); } if (image.Width > 0) { AttributeCheck(attributes, "width", image.Width.ToString()); } return(format.Formatted(image.Src, Utility.ConvertAttributes(attributes))); }
/// <summary> /// Renders HTML for an image /// </summary> /// <param name="image">The image to render</param> /// <returns>An img HTML element</returns> public string RenderImage(FieldTypes.Image image) { return(RenderImage(image, null)); }