public void GenerateRss(StringBuilder sb, SlideShowRssMediaType rssType, SlideShowImageSize targetImageSize, bool insertSizes, bool debug) { string url = this.url; int width = this.width; int height = this.height; if (this.urlSizeAware) { url = url.Replace("<SIZE>", "s=" + ((int)targetImageSize).ToString()); width = SlideShow.slideShowImageWidths[(int)targetImageSize]; height = SlideShow.slideShowImageHeights[(int)targetImageSize]; } if (insertSizes) { if (width == -1) { width = SlideShow.slideShowImageWidths[(int)targetImageSize]; } if (height == -1) { height = SlideShow.slideShowImageHeights[(int)targetImageSize]; } } string linkUrl = ""; if (rssType == SlideShowRssMediaType.LinkMedia) { linkUrl = url; } else { linkUrl = "http://" + Config.GetSetting("HostSite"); } sb.Append("<item>"); sb.Append("<title>" + HttpUtility.HtmlEncode(this.title) + "</title>"); sb.Append("<link>" + HttpUtility.HtmlEncode(linkUrl) + "</link>"); sb.Append("<category>" + HttpUtility.HtmlEncode(this.title) + "</category>"); // Write out the description sb.Append("<description>"); sb.Append("<![CDATA["); sb.Append("<img src=\"" + url + "\"><br/>" + HttpUtility.HtmlEncode(this.title)); if (debug) { sb.Append("<br/>"); sb.Append("Expiraton date " + this.ExpDate.ToString() + "<br/>"); sb.Append("<a href=\"" + url + "\">" + HttpUtility.HtmlEncode(url) + "</a><br/>"); } sb.Append("]]>"); sb.Append("</description>"); // Write out the publish date (if we have one) // Format of date in RSS feed: Tue, 22 Jan 2008 20:26:39 -05:00 if (this.PubDate != DateTime.MinValue) { sb.Append("<pubDate>" + TimeUtil.DateToRSSString(this.PubDate) + "</pubDate>"); } if (rssType != SlideShowRssMediaType.LinkMedia) { string widthText = ""; string heightText = ""; string tag = ""; string durationText = ""; if (rssType == SlideShowRssMediaType.EnclosureRss) { tag = "enclosure"; } else if (rssType == SlideShowRssMediaType.MediaRss) { tag = "media:content"; if (width != -1) { widthText = "width=\"" + width + "\" "; } if (height != -1) { heightText = "height=\"" + height + "\" "; } } sb.Append("<" + tag + " type=\"image/jpeg\" " + widthText + heightText + "url=\"" + HttpUtility.HtmlEncode(url) + "\" " + durationText + "/>"); } sb.Append("</item>"); }
// // GetImageFileName // // Will get the image file name representing the item // public static string GetImageFileName(string language, string location, string templateDirectory, string weatherImageDirectory, SlideShowImageSize imageSize, bool bypassCaches) { string fileName = ImageUtil.GetCompiledImageDirectory("Weather") + language + "_" + location + "_" + ((int)imageSize).ToString() + ".jpg"; if (!bypassCaches && MiscUtil.TTLFileExists(fileName, CompiledWeather.weatherImageTTL)) { return(fileName); } else { CompiledWeather compiledWeather = CompiledWeather.LoadForImage(language, location, bypassCaches); Bitmap bitmap = compiledWeather.GenerateImage(fileName, templateDirectory, weatherImageDirectory, imageSize); return(fileName); } }
// // GetImageFileName // // Will get the image file name representing the item // public static string GetImageFileName(int compiledTextFeedHash, Guid compiledTextFeedGuid, int compiledTextFeedItemHash, SlideShowImageSize imageSize, string templateDirectory, bool bypassCaches) { string fileName = ImageUtil.GetCompiledImageDirectory("TextFeed") + compiledTextFeedGuid.ToString() + "_" + compiledTextFeedItemHash.ToString() + "_" + ((int)imageSize).ToString() + ".jpg"; if (!bypassCaches && MiscUtil.TTLFileExists(fileName, CompiledTextFeedItem.textFeedImageTTL)) { return(fileName); } else { CompiledTextFeedItem compiledTextFeedItem = CompiledTextFeedItem.LoadForImage(compiledTextFeedItemHash, compiledTextFeedHash, compiledTextFeedGuid); Bitmap bitmap = compiledTextFeedItem.GenerateImage(fileName, imageSize, templateDirectory); return(fileName); } }