public override string GetHtml()
{
if (this.ContentPage == null) {
this.ContentPage = SiteData.GetCurrentPage();
}
this.ImgSrc = this.ContentPage.Thumbnail;
this.Title = this.ContentPage.NavMenuText;
if (String.IsNullOrEmpty(this.ImgSrc)) {
// if page itself has no image, see if the image had been specified directly
this.ImgSrc = this.ImageUrl;
}
if (!String.IsNullOrEmpty(this.ImgSrc)) {
if (this.PerformURLResize) {
ImageSizer imgSzr = new ImageSizer();
imgSzr.ImageUrl = this.ImgSrc;
imgSzr.ThumbSize = this.ThumbSize;
imgSzr.ScaleImage = this.ScaleImage;
this.ImgSrc = imgSzr.ImageThumbUrl;
}
} else {
this.ImgSrc = String.Empty;
}
if (!String.IsNullOrEmpty(this.ImgSrc)) {
var imgBuilder = new TagBuilder("img");
imgBuilder.MergeAttribute("src", this.ImgSrc);
if (!String.IsNullOrEmpty(this.Title)) {
imgBuilder.MergeAttribute("alt", this.Title);
imgBuilder.MergeAttribute("title", this.Title);
}
var imgAttribs = (IDictionary<string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(imageAttributes);
imgBuilder.MergeAttributes(imgAttribs);
return imgBuilder.ToString(TagRenderMode.SelfClosing);
} else {
return String.Empty;
}
}