Class RssImage

java.lang.Object
com.oorian.rss.RssImage

public class RssImage extends Object
Represents an RSS channel <image> element for the channel logo.

The image element specifies a GIF, JPEG, or PNG image that can be displayed with the channel. The url, title, and link sub-elements are required. Width and height are optional (defaults: 88 and 31, maximum: 144 and 400 respectively per RSS 2.0 spec).

Usage:


 RssImage image = new RssImage(
     "https://example.com/logo.png",
     "My Blog",
     "https://example.com"
 );
 image.setWidth(144).setHeight(100);
 
Since:
0.1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • RssImage

      public RssImage(String url, String title, String link)
      Creates an image with the required url, title, and link.
      Parameters:
      url - The URL of the image file (GIF, JPEG, or PNG).
      title - The alt text for the image, typically matching the channel title.
      link - The URL of the site; the image links to this when rendered.
  • Method Details

    • setWidth

      public RssImage setWidth(int width)
      Sets the width of the image in pixels (maximum 144).
      Parameters:
      width - The image width in pixels.
      Returns:
      This image for method chaining.
    • setHeight

      public RssImage setHeight(int height)
      Sets the height of the image in pixels (maximum 400).
      Parameters:
      height - The image height in pixels.
      Returns:
      This image for method chaining.
    • setDescription

      public RssImage setDescription(String description)
      Sets an optional text description of the image.
      Parameters:
      description - The image description.
      Returns:
      This image for method chaining.
    • getUrl

      public String getUrl()
    • getTitle

      public String getTitle()
    • getLink

      public String getLink()
    • getWidth

      public int getWidth()
    • getHeight

      public int getHeight()
    • getDescription

      public String getDescription()
    • toXmlElement

      public com.oorian.xml.XmlElement toXmlElement()
      Converts this image to an XmlElement.
      Returns:
      An XmlElement representing this <image> element with its sub-elements.