SlideShowPro Director RSS Generator

December 10th, 2009 Leave a comment Go to comments

I wrote this script for my own purposes. I got my mom a wireless photo frame for Christmas, and I wanted a way for it to connect to my SlideShowPro Director installation, instead of having to duplicate my photos on Photobucket or Flickr or whatever.

This script works great with FrameChannel.com, a free service that’s compatible with the frame I bought.

I’m not an XML guru or anything… I modeled the XML on Photobucket’s RSS output. Seems to work great. If you find any problems or bugs, please report them in the comments section below.


Requirements:

  • PHP 5, with “mbstring” extension loaded
  • SlideShowPro Director
  • DirectorPHP
    This is a free accessory for SSP Director users. You can download it from the SlideShowPro website.

License:

None. Have fun, use at your own risk, etc. :)


Installation:

First, download the archive and unzip it somewhere. Then, open rssconfig.php in a text editor and set the options in the configuration section. The definition of each option is below. Once set, upload rssconfig.php and rss.php to your web server. When rss.php is requested, it will produce an RSS feed for the specified album.

Options:

  • $album_num
    Type: number
    The album number to generate RSS for by default. This can be found on the “Settings” screen for the album, as part of the Album id. Ex: If you have “Album id: album-6″, “6″ is what you would use here.
  • $use_query
    Type: true/false
    If this is set to false, the script will ONLY generate a feed for the album listed in $album_num. If it’s set to true, you can request a feed for any album by adding “?album=X” to the end of the script URL, where “X” is the album number you’re requesting. Example:
    http://my.dom.ain/rss.php?album=4
  • $api_key
    $api_path

    Type: string
    Your API key and path for connecting to the SlideShowPro Director API. You can find these in Director, by clicking the “System info” link at the top right of the Director administrative interface. The key and path can be found at the bottom of that page.
  • $album_link
    Type: string
    Put the URL to your album page or website here.
  • $class_path
    Type: string
    This is the path to the “DirectorPHP.php” class file.
  • $language
    Type: string
    Pretty self explanitory. If english isn’t appropriate for your locale, you should be able to find the right code here.
  • $ttl
    Type: number
    TTL stands for “Time To Live” and is used to specify how old something should be before the system using it should reload the data from the source. The number is in minutes.
  • $test_for_mb_translation
    Type: true/false
    This setting deals with multibyte characters. If you’re using English only, you won’t need to change this. If you’re using a language that uses multibyte or “special” characters, you *might* need to set this to true, but probably not. Note that if you set it to true, you’ll probably have to change a PHP setting via a .htaccess file. See the troubleshooting section for details.

Troubleshooting:

“PHP parameter mbstring.encoding_translation is ‘0‘, not ‘1′. Please set in php.ini, httpd.conf or .htaccess.”

This setting can’t be changed from within the script. If you’re using apache as your web server, create a file named .htaccess (that’s “<dot>htaccess”). Open that file in a text editor, and add the following line:

php_flag mbstring.encoding_translation on

Save the file and upload it to your web server, in the same directory as rss.php. If a .htaccess file already exists in that directory, just add the line to the existing file.

If you’re using a Windows web server, I believe this needs to be set in php.ini by your web provider. If someone knows of a way around that, please let me know.


“PHP parameter mbstring.language is ‘xxx‘, not ‘neutral’. Please set in php.ini, httpd.conf or .htaccess.

This setting can’t be changed from within the script. If you’re using apache as your web server, create a file named .htaccess (that’s “<dot>htaccess”). Open that file in a text editor, and add the following line:

php_value mbstring.language neutral

Save the file and upload it to your web server, in the same directory as rss.php. If a .htaccess file already exists in that directory, just add the line to the existing file.

If you’re using a Windows web server, I believe this needs to be set in php.ini by your web provider. If someone knows of a way around that, please let me know.


Changelog:

2009.12.10.2

  • Added $test_for_mb_translation option.
  • Fixed date bug (thanks Mika!)

2009.12.10.1

  • Removed $charset configuration option.
  • Added multibyte character support, to fix international character support that was “fixed” (not) in the previous release.
  • Moved configuration options to a separate file (rssconfig.php) to make future upgrades easier.

2009.12.09.0

  • Added $charset configuration option.
  • Fixed international character support.
  • Replaced hardcoded character set in generated XML.

2009.11.16.1

  • Fixed hardcoded URL in generated XML.

2009.11.15.1

  • Initial release.
  1. February 10th, 2010 at 15:50 | #1

    @Nik

    Nik :

    @Nik

    it seems to be the line 48 in the Utils.php of the director class, if I comment that out, it works.

    Can you post that line of code for me?

    @Nik

    Nik :

    @Nik

    Anyway, did I miss some settings or what do I have to change to have the rss links directing to the page/slideshow with the image instead of the original URL image?

    Is it also possible to have thumbnails of the images in the rss?

    Thank’s in advance for your help

    I haven’t seen any way using the Director API to get a URL for a thumbnail, unfortunately. Without thumbnails, there’s not much point in including the thumbnail attribute in the XML. You could, using the original image, I suppose, but if you’re publishing images that are thousands of pixles high/wide, it wouldn’t be a very attractive solution.

  2. February 10th, 2010 at 15:42 | #2

    @Nik
    Hi Nik,

    What version of SSP Director are you using? I wrote and tested the script against 1.4.1, and I just upgraded to the latest and it’s still working for me.

    If you like, you can e-mail me a link to the script on your site and I can take a look. Also, it’d be helpful if you can tell me what that line of code is that it’s generating the error on.

  3. Nik
    February 10th, 2010 at 05:07 | #3

    @Nik

    it seems to be the line 48 in the Utils.php of the director class, if I comment that out, it works.

    Anyway, did I miss some settings or what do I have to change to have the rss links directing to the page/slideshow with the image instead of the original URL image?

    Is it also possible to have thumbnails of the images in the rss?

    Thank’s in advance for your help

  4. Nik
    February 10th, 2010 at 02:49 | #4

    I got a lot of errors/warnings

    a lot of these:
    Warning: DirectorUtils::decode() [function.DirectorUtils-decode]: Cannot assign to an array of nodes (duplicate subnodes or attr detected) in /var/www/…/…/…/DirectorPHP/classes/Utils.php on line 48

    and after that:
    Warning: Cannot modify header information – headers already sent by (output started at /var/www/…/…/…/classes/Utils.php:48) in /var/www/…/…/…/rss.php on line 109

  5. December 10th, 2009 at 10:01 | #5

    @Mika
    I added multibyte character support, so all internationalization issues should be resolved. Let me know if you still have any troubles!

  6. Mika
    December 9th, 2009 at 09:46 | #6

    Ok, that was the problem with Firefox’s reader, I got all the pictures in the Google Reader. But there’s one problem, I have ä and ö (Finland) letters in my captions, they are just showing some code symbols. Anyidea how to fix that?

  7. December 9th, 2009 at 09:33 | #7

    @Mika
    Hi Mika,
    Can you e-mail me the link to the script? My email is steve @ [this domain].

  8. Mika
    December 9th, 2009 at 09:25 | #8

    Anyway to change how old pictures in chosen album will be shown in RSS feed?

    I have currently a intelligent album which shows 20 recent photos in my whole gallery and rss feed only shows four of them?

  1. No trackbacks yet.