RSSPhoto is a WordPress plugin to display photos from RSS and Atom feeds. It includes a widget for easy addition to a sidebar, or it can be configured by shortcode to display on any page. Easy theme integration is also possible. RSSPhoto includes jQuery-powered, cross-browser compatible slideshow as well as static image display.
RSSPhoto uses the built-in WordPress functions to parse RSS and Atom feeds (which are based on SimplePie). A cache directory, writable by the server, is required for thumbnail storage. The GD library is required for generating thumbnails.
RSSPhoto install simply requires creating a writable directory in
wp-content/cache to store thumbnails, and installing/activating the plugin itself:
- If it doesn’t already exist, create the directory
wp-content/cacheand give it permissions of 755
- Upload all files to the
- Activate the plugin through the ‘Plugins’ menu in WordPress
To use the widget:
- Navigate to the ‘Widgets’ section of the ‘Appearance’ menu in WordPress
- Drag the widget to the sidebar
- Configure the widget as needed
To use the shortcode:
- Edit the page you want to display the images
Add the following text to the page:
Include any of the following attributes (see descriptions of these settings below)
- img_sel=”Most Recent”
To integrate with a theme:
- The plugin needs to be installed and activated.
- Copy and paste the contents of the file
RSSPhotoTheme.functions.phpto the end of the file
functions.phpin your theme directory.
- Declare RSSPhoto settings (multiple instances are supported).
Call the function
display_rssphoto()from your theme (e.g.,
sidebar.php). An example of the last two steps:
<?php $settings['title']='RSSPhoto'; $settings['url']='http://photography.spencerkellis.net/rss.php'; $settings['height']=150; $settings['width']=185; $settings['img_sel']='Random'; $settings['num_img']=1; $settings['item_sel']='Random'; $settings['num_item']=10; $settings['show_title']=1; $settings['show_img_title']=1; $settings['output']='Slideshow2'; $settings['interval']=6000; $settings['before_title']='<h2>'; $settings['after_title']='</h2>'; $settings['before_html']='<li>'; $settings['after_html']='</li>'; display_rssphoto($settings); ?>
Here’s a quick description of the settings:
- (title) Title: Text that appears over the RSSPhoto image(s). “String in quotes”
- (url) URL: address of the RSS or Atom feed. “http://your.url.com/feed.xml”
- (height) Height: height of the RSSPhoto images in pixels; or, ‘variable’ to maintain the aspect ratio given the specified width (see #4). [Number]|”variable”
- (width) Width: width of the RSSPhoto images in pixels; or, ‘variable’ to maintain the aspect ratio given the specified height (see #3). [Number]|”variable”
- (img_sel) Image selection: the script can randomly select images or just display the first image in the feed item. “Random”|”Most Recent”
- (num_img) # Images per Item: how many images embedded in each feed item to display. [Number]
- (item_sel) Item Selection: RSSPhoto will choose a random feed item, or the most recent feed item. “Random”|”Most Recent”
- (num_item) # Items: choose how many feed items to display. [Number]
- (show_title) Show Title: whether to display the main RSSPhoto title over the images. 1|0
- (show_img_title) Show Image Titles: whether to display the titles of each displayed thumbnail. 1|0
- (output) Output: images will load as a slideshow or can be displayed statically. “Slideshow2″|”Slideshow”|”Static”
- (interval) Slideshow Interval: the amount of time in milliseconds to wait between image transitions for the slideshows. [Number]
Note that for the
width properties you should only set one or the other to “variable”, since RSSPhoto will use the other integer-valued dimension to fix the aspect ratio.
- How do I change the title, feed URL, or dimensions for a widget?
After your widget appears in the sidebar, go to the ‘Widgets’ section under the ‘Appearance’ menu in WordPress and open the settings for the widget (click the down arrow in the widget titlebar and the form will appear). Modify the fields as needed and click save.
- Is there a way to prevent very small images from being displayed?
Yes, you can set a variable to require a minimum size (in pixels) of either width or height. In
RSSPhoto.class.php, look for
var $min_size = 10;
And change the value as needed (default is 10 pixels).
- My feed doesn’t display any photos and there are no problems with the feed validation
RSS feeds can be implemented in numerous ways. RSSPhoto attempts to intelligently find the pictures in an RSS feed, but sometimes you need to point it in the right direction. In
RSSPhoto.class.php, try changing the value of the variable
$rss_type_srcto one of the following values: ‘Choose’ (default), ‘Description’, ‘Content’, or ‘Enclosures’.
- My feed doesn’t display any photos; W3C Feed Validation says it’s valid but has a warning about wrong media type
If you get a warning from the W3C Feed Validation Service about your feed being served with the wrong media type, and RSSPhoto doesn’t display your images, you may need to install the SimplePie Core plugin and force RSSPhoto to use it. The integrated SimplePie refuses to parse the feed because of the incorrect media type. Follow the FAQ point below to enable SimplePie Core. Then, open
RSSPhoto.class.phpand set the
var $force_feed = true;
- How do I force RSSPhoto to use the SimplePie Core plugin so I have access to more feed-level options for troubleshooting?
To be clear, this option is available for fringe cases and is not expected to be commonly used (hence getting down and dirty with the code). An example is where the XML feed does not set its headers correctly and the SimplePie “force_feed” option must be set.
First, de-activate RSSPhoto. Next, install and activate the SimplePie Core plugin (not the full SimplePie plugin). Here’s a link to the SimplePie Core plugin.
RSSPhoto.class.phpand change the value of the variable
$parserfrom ‘built-in’ to ‘simplepie-core’:
var $parser = 'simplepie-core';
Re-activate RSSPhoto. That’s it!
- I’m getting an error about the SimplePie class not being found. What’s wrong?
This should only happen if you have followed the directions above to force RSSPhoto to use the SimplePie Core plugin.
Here’s what the error might look like:
Fatal error: Class .SimplePie. not found in /home/username/public_html/wp-content/plugins/rssphoto/rssphoto.php on line 40
If you receive this error, the most likely problem is that the SimplePie Core plugin is not installed or activated. Here’s a link to the SimplePie Core plugin.
- I’m still having problems. What should I do?
Please feel free to leave a comment at the plugin’s website. I usually respond fairly quickly.
If you’re interested in getting your hands dirty, there’s a debug mode you can enable. In
RSSPhoto.class.php, set the
$debugvariable to 1:
var $debug = 1;
By default, the debug output is hidden in HTML comments (<!– and –>), so view the page source to find the debug messages. This could offer some useful information and could help in leaving detailed comments for troubleshooting.
Contributors & Developers
“RSSPhoto” is open source software. The following people have contributed to this plugin.
- Improved display of Slideshow v2 in IE; known issue with opacity but there are no black or white bars any more
- Fixed a layout glitch to clear after the RSSPhoto div so elements below will align properly
- Introduction of Slideshow v2: principal improvement is the ability to fade in and out image titles when the user moves the cursor over the image.
- Simplified method for specifying dimensions: set the width and height directly, and RSSPhoto will automatically general thumbnails without distortion from incorrect aspect ratio.
- Introduction of a debug mode to simplify troubleshooting
- Bug fix: previous versions could generate incorrect paths to the cache when the blog URL and wordpress URL were different, resulting in no thumbnails being displayed.
- Various stability, performance, and bug fixes.
- Bug fix: extra HTML tags which distorted the sidebar layout
- Bug fix: removed check for thumbnail cache directory which caused problems in some installs
- RSSPhoto no longer requires the SimplePie Core plugin! (but support for using SimplePie Core plugin is preserved). Instead, the WordPress built-in
fetch_feedfunction is used.
- Improved error messages and feedback
- Various stability improvements
- Added the (beta-version) capability to show image titles although the option has not been extended to the widget settings UI yet (see FAQ)
- Compatibility update for yet another different mime type that means “jpeg”
- Stability update: works “out-of-the-box” with all the feeds I’ve encountered so far in troubleshooting, except where SimplePie settings need to be changed
- Performance improvements: removed an http request from the critical path for thumbnail generation
- When embedded images are small, RSSPhoto will now allow upscaled locally cached thumbnails (previously, images would not be displayed at all)
- Added support for wordpress.com feeds
- Improved RSS parsing code to handle more implementation varieties (specifically better handling of enclosures)
- Added support for MobileMe (Apple) RSS feeds
- Added support for theme integration
- Added a method for retrieving images from different portions of an RSS 2.0 feed (Atom feeds remain the same)
- Add support for images contained in RSS enclosure tags
- Fixed an annoyance where slideshow would play with only one image
- Add shortcode support allowing RSSPhoto to be displayed on any page
- Further improved code organization, separating RSSPhoto code from shortcode and widget code.
- Re-introduced multi-widget support
- Bug fix; v0.5 required PHP5. v0.5.1 should restore PHP4 support.
- Added jQuery slideshow option (default)
- Intelligently selects content or description tag based on feed type
- Streamlined options to make widget configuration simpler
- Improved code organization with better class structure and readability
- !Important: Removed multi-widget support!
- Added support for solution to display images from a feed with incorrectly identified media type
- Added support for multiple images and multiple feed items
- Added support for filtering out images smaller than a user-defined pixel value (height or width)
- Reconfigured to the Widget options panel to reduce the height
- Added support for PNGs and GIFs
- Improvement on previous bug fix to use bloginfo ‘wpurl’ variable to form thumbnail URL
- Separate out image selection from feed item selection (so you can select a random image from the most recent
feed item or vice versa)
- Improve the display of the Widgets settings as more options were becoming available
- Major bug fix with thumbnail URLs pointing to the wrong location
- Allow multiple RSSPhoto widgets to be present simultaneously
- Selection of fixed width, height, or max dimension for thumbnails
- Selection of pulling images from Content tags or Description tags from feeds
- Fixed a bug where changing the thumbnail size wouldn’t be reflected due to cached thumbnails with the same filename
- Rolled up all other bug fixes from 0.1.* plus fixed a bug where there was no default value for the Image Selection field.
- Fixed a bug where the title may not have been saved properly
- Fixed an issue where the Max dimensions field had the wrong label
- Original version
- Specify widget title
- Accepts any RSS or Atom feed URL
- Customize thumbnail size
- Select random or most recent image selection method