예제 #1
0
        public static MvcHtmlString ImageOrDefault(this HtmlHelper helper, String id, String imageUrl, Object htmlAttributes = null, String defaultImageUrl = "~/images/missing.png", String alternateText = "", Boolean localizable = false)
        {
            // Culture first
            var urlHelper   = new UrlHelper(helper.ViewContext.RequestContext);
            var newImageUrl = imageUrl;

            if (localizable)
            {
                newImageUrl     = UrlExtensions.GetLocalizedUrl(urlHelper, imageUrl);
                defaultImageUrl = UrlExtensions.GetLocalizedUrl(urlHelper, defaultImageUrl);
            }

            // Requested image or default image if not found
            return(ImageOrDefaultInternal(helper, id, newImageUrl, htmlAttributes, defaultImageUrl, alternateText));
        }