Example #1
0
        internal static string ImageToli(Smugmug.Album album, Smugmug.Image image, bool useLightBox)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("<li>\n<div>");

            if (useLightBox)
            {
                builder.Append(string.Format("<a href=\"{0}\" title=\"{1}\" rel=\"lightbox[{2}]\">", image.LargeUrl, Utils.CaptionToHtml(image.Caption), album.Key));
            }
            else
            {
                builder.Append(string.Format("<a href=\"{0}\" title=\"{1}\">", image.LargeUrl, Utils.CaptionToHtml(image.Caption)));
            }
            builder.Append(string.Format("<img src=\"{0}\" alt=\"{1}\">", image.ThumbUrl, Utils.CaptionToHtml(image.Caption)));
            builder.Append("<br>");
            if (image.Caption != "")
            {
                builder.Append(string.Format("{0}", Utils.CaptionToHtml(image.Caption)));
            }
            else
            {
                builder.Append(string.Format("{0}", "&nbsp;"));
            }
            builder.Append("</a></div>\n</li>");
            return(builder.ToString());
        }
Example #2
0
        internal static string GenerateContentHtml(Smugmug.Image selectedPhoto, string imageUrl, string cssClass, string border, string vSpace, string hSpace, string alignment, bool hyperlink)
        {
            StringBuilder imageTag  = new StringBuilder();
            string        imageHtml = string.Empty;

            imageTag.Append("<img ");                                                                       // begin tag
            imageTag.Append(string.Format("src=\"{0}\" ", HtmlServices.HtmlEncode(imageUrl)));
            imageTag.Append(string.Format("alt=\"{0}\" ", HtmlServices.HtmlEncode(selectedPhoto.Caption))); // alt required for XHTML
            imageTag.Append(string.Format("border=\"{0}\" ", HtmlServices.HtmlEncode(border)));

            if (cssClass.Trim().Length > 0)
            {
                imageTag.Append(string.Format("class=\"{0}\" ", cssClass));
            }

            if (hSpace.Trim().Length > 0 && hSpace != "0")
            {
                imageTag.Append(string.Format("hspace=\"{0}\" ", hSpace));
            }

            if (vSpace.Trim().Length > 0 && vSpace != "0")
            {
                imageTag.Append(string.Format("vspace=\"{0}\" ", vSpace));
            }

            if (alignment.Trim().Length > 0 && alignment.ToLower() != "none")
            {
                imageTag.Append(string.Format("align=\"{0}\" ", alignment.ToLower()));
            }

            imageTag.Append("/>"); // end tag XHTML

            imageHtml = imageTag.ToString();

            if (hyperlink)
            {
                imageHtml = string.Format("<a href=\"{0}\" title=\"{2}\">{1}</a>", HtmlServices.HtmlEncode(selectedPhoto.AlbumUrl), imageHtml, HtmlServices.HtmlEncode(selectedPhoto.Caption));
            }

            return(imageHtml);
        }