Since version 8 JAlbum supports RSS feeds for the generated webalbums. Unfortunately, the feeds are not accepted by standard RSS readers like Google Reader and NetNewsWire. Bummer! The problems are caused by:

  1. the fact that the generated feeds contains relative URLS (and RSS requires absolute URLs)
  2. the way JAlbum feeds try to include feeds of subfolders. The goal of including the items of subfolders in the parent RSS feed is to make it possible to subscribe to 1 feed and also get items in subolders included (instead of having to subscribe to each subfolder feed separately). JAlbum uses a proprietary JAlbum tag (<jalbum:link..>)to include sub folder RSS feeds and this tag is nog recognized by regular RSS feeds

You can try this out by running the generated feeds through feedvalidator.org. As an example, here's the result of running an original JAlbum generated RSS feed through feedvaidator.org. In addition to the reported erros, the <jalbum:link..> tags are nog recognized by regular RSS readers.

Luckily JAlbum is pretty open and you can easily customized skins and also the template that generates the album.rss feed. The issue with the relative URLs could easily be fixed by adding a user defined variable in JAlbum and some minor adjustments to the album.rss template.

The issue with the inclusion of images from subfolders required a bit more work. It appears that there is no (standard) way to have an RSS feed include another RSS feed. So I changed the albums.rss template such that items of subfolder are also added to the album.rss feed file of the parent folder. No real inclusion and it feels a bit redundant to include items in the RSS feed of the folder itself and in the feeds of all parent folders, but at least the feed is now working in regular RSS readers. Here's an example of a feed.

While implementing the new template file I did run into a few problems that I could not explain, but did find a workaround for. First, it was not possible to use a javax.xml.transform.Transformer, but using org.w3c.dom.ls.LSSerializer it worked fine. Second, some of the standard JAlbum variable sdid not always have the same Java type and sometimes were simply not set when trying to access them from the album.rss tempate. So I had to test for this, try to convert to required type where possible and if all failed, the picture is ignored and not included in the RSS feed. The template now runs successfully on my webalbum picture collection (4500 pictures).

Also want to use this?

  1. Make a backup of the Jalbum/system/album.rss file. This is the original template file.
  2. Download the updated album.rss file and copy it to Jalbum/system directory
  3. Add a user variable 'webroot' to your JAlbum project. Go to Settings/Advanced/User Variables. The value of this variable should be the root of the webalbum on your webserver (for example http://my.domain/webalbum)
  4. (Optionally) Add a user variable rssItemsNotOlderThanDays to your JAlbum project. If set, then only pictures which is not older than 'rssItemsNotOlderThanDays' days are included in the RSS feed. If not set, all pictures found are included and that may lead to rather big feed files.
  5. --ADDED--
    (Optionally) Add a user variable topAlbumTitle to your JAlbum project. If set, then the value of the variable will be used as the title for the top level directory (if not set, the title of the top level directory is empty).
    -- EA ADDED--

Note: I've been using this with JAlbum version 8.1.5. I suspect that it will work with all 8.x versions, but I'm not sure.

Update:

Based on suggestions in the JAlbum forum I made some minor changes to the template:

  • JAlbum variable mediarssDate is used a pubDate (instead of picture date, this was already the case in the original template)
  • Added copyright notices
  • Corrected the way the guid is determined

41 comments:

  1. Gero said...

    Hi Gero,

    this is great work and really appreciated! I wrote a short posting about your efforts in my own blog.


    Note: Comment imported. Original by Mario ( email: mario@santas-little-helper.de website: http://www.knecht-ruprecht.info ) at 2009-01-16 20:53  

  2. Gero said...

    Hi Gero, thanks for your work! I shall look into how we can make Jalbum's RSS feed better and more compatible as a default. We might change just when an RSS feed is generated from album build time to publish time. Then Jalbum would know the destination URL and could produce absolute links right away.
    Note: Comment imported. Original by David Ekholm ( email: david@jalbum.net website: http://jalbum.net ) at 2009-01-17 09:16  

  3. Gero said...

    David,

    I would stick with an Option to enter an absolute URL. Due to the size of my album I don't use JAlbum to publish my gallery but sitecopy - so I won't benefit from your proposed change.
    Note: Comment imported. Original by Mario ( email: mario@santas-little-helper.de website: http://www.knecht-ruprecht.info ) at 2009-01-17 09:43  

  4. Gero said...

    Ok, we shall try to keep in mind those who wish to use other tools for publishing albums. Jalbum could make a "best guess" on the album URL during the make album process. The best guess could then be overridden by a variable.
    Note: Comment imported. Original by David Ekholm ( email: david@jalbum.net website: http://jalbum.net ) at 2009-01-17 09:51  

  5. Gero said...

    Sounds like a plan ;-) Thanks!

    Note: Comment imported. Original by Mario ( email: mario@santas-little-helper.de website: http://www.knecht-ruprecht.info ) at 2009-01-17 11:37  

  6. Gero said...

    Hi Gero,
    I just wanted to try this with the 8.1.6 release (not tested before) and I get the following error message:
    Evaluation error on line 14:

    Details:
    Sourced file: inline evaluation of: `` boolean includeItem = includeItem(); // Collect item deta . . . '' : Undefined argument: comment

    Any ideas?
    Note: Comment imported. Original by Mario ( email: mario@santas-little-helper.de website: http://www.knecht-ruprecht.info ) at 2009-01-31 11:03  

  7. Gero said...

    Mario-

    I too received the same error. Make sure you have a value for the 'rssItemsNotOlderThanDays'.
    I used 30 and the error went away.
    Note: Comment imported. Original by Xtreme EyeWitness at 2009-02-01 04:44  

  8. Gero said...

    Hi Gero,

    I'm just refreshing my album, no error till now. I thought this second varaible was optional so I did not include it at all. If I want to include all pics I have to enter a very large number of days, haven't I?
    Note: Comment imported. Original by Mario ( email: mario@santas-little-helper.de website: http://www.knecht-ruprecht.info ) at 2009-02-01 11:21  

  9. Gero said...

    Doesn't work for me :-( Not sure why.

    I recognized that I receive a backslsh in my RSS URLs, heres an example:
    <atom:link href="http://bilder.nt99.de/\1999xxyy_Klausdorf/album.rss" rel="self" type="application/rss+xml" />

    This is strange. If I enter the webroot value (http://bilder.nt99.de) w/o the slash the backslash will be there.

    Anyway, currently the feed is not recognized by CoolIris any longer and I can't add it to Blogger picture viewer or Google Reader.

    What am I doing wrong? Thanks for your support!


    Note: Comment imported. Original by Mario ( email: mario@santas-little-helper.de website: http://www.knecht-ruprecht.info ) at 2009-02-01 12:24  

  10. Gero said...

    Mario,

    The rssItemsNotOlderThanDays variable is indeed optional. The includeItem() method in the album.rss file check is the variable is set and if not set it always returns true (so all pictures are included).

    The only reason I can think of why settings this variable would help is the parts of you webalbums have been generated before with an older version of the JAlbum/skin and that that version is not handling the 'existence' of a comment correctly as David suggested.

    Gero
    Note: Comment imported. Original by Gero Vermaas ( email: gero@vermaas.net website: http://vermaas.net ) at 2009-02-01 19:46  

  11. Gero said...

    Mario,

    Maybe there is a platform specific issue here. Are you running on Windows by any chance? (since the \ is a path separator on Windows).

    What is the value of the setting 'outputDirectory' in your albums JAP file? does it have a '/' at the end?

    Gero
    Note: Comment imported. Original by Gero Vermaas ( email: gero@vermaas.net website: http://vermaas.net ) at 2009-02-01 19:52  

  12. Gero said...

    Gero,

    yes, Windows's in the house ;-)

    My output path is as follows:
    e:\Fotographie\bilder.nt99.de

    Maybe I'll try some search and replace to have an RSS file to test whether this works in general.


    Note: Comment imported. Original by Mario ( email: mario@santas-little-helper.de website: http://www.knecht-ruprecht.info ) at 2009-02-01 20:11  

  13. Gero said...

    Yes, that would be a good idea to first try and fix it manually on 1 of the generated RSS files and test with that one. After that it should easy to adjust the template.

    As a sidenote, in the original album.rss file there were some <jalbum:...> tags that I have removed (because I did not need them). If these are crucial for CoolIres you can re-add them (just don't add the one the includes the album.rss files of subdirectories cause then you'd have all items double).

    Gero
    Note: Comment imported. Original by Gero Vermaas ( email: gero@vermaas.net website: http://vermaas.net ) at 2009-02-01 20:43  

  14. Ray said...

    Gero,

    Thanks so much for the effort you've put into this effort. Looking at the differences between the original and your album.rss you've obviously invested some time to get this working. I'm having an issue because I also post videos to my albmus as well as photos. Videos don't have the "Date Picture Taken" attribute set and it's causing your script to complain. Is there an easy way to fix this problem? If I new how to manually set the date it that would probably do it.  

  15. Ray said...

    BTW - This is the error I received....

    Evaluation error on line 144:

    Details:
    Sourced file: inline evaluation of: ``boolean includeItem = includeItem(); // Collect item deta . . . '' : Attempt to resolve method: getTime() on undefined variable or class name: originalDate  

  16. Gero said...

    Ray,

    Thanks for the comment. I was not able to reproduce the problem, but could see why this problem occurs. I made the album.rss template script a more robust. Can you download the new version and give it a try? (http://gerodt.homeip.net/chameleon-customization/8.1/album.rss)

    Gero  

  17. promeneur said...

    i have a pb with your album.rss (7/3/2009)

    my config :
    Linux Mandriva 2008.1
    Jalbum 8.0.9 or 8.2.3

    i have the user variables :
    RssItemsNotOlderThanDays 30
    webroot "url of my site"

    when i create the album by clicking "Modify"
    i have the following error message :

    Parse error at line 114, column 14. Encountered: null

    Details:
    inline evaluation of: `` import se.datadosen.util.Replacer; import
    java.util.ArrayList; import jav . . . ''

    with your album.rss 8/8/2009

    i have another error message
    i use only webroot user variable

    Evaluation error on line 149:

    Details:
    Sourced file: inline evaluation of: `` boolean includeItem = includeItem(); // Collect item deta . . . '' : Attempt to resolve method: getTime() on undefined variable or class name: originalDate


    thanks for your work

    Philippe  

  18. Gero said...

    Philippe,

    I added more validation checking around the use of the originalDate variable. It should work now. Please redownload the albums.rss file and retry it (gerodt.homeip.net/chameleon-customization/8.1/album.rss).

    I added the CVS revision number to the file (4th line), this is version 1.22.

    Gero  

  19. promeneur said...

    i tried 1.22

    i have this error message

    Evaluation error on line 27:

    Details:
    Sourced file: inline evaluation of: `` boolean includeItem = includeItem(); // Collect item deta . . . '' : Void assignment.  

  20. Gero said...

    Philippe,

    Can you mail me the picture(s) that lead to this error? What JAlbum skin are you using? I cannot reproduce the problem.

    Gero  

  21. Joy Rumwir said...

    I feel really stupid.. but I'm a newbie at this. Where do I download the updated album.rss to make this work? I am using chameleon skin right now.  

  22. Gero said...

    Well... step 2 in the blog post has a link to it:

    http://gerodt.homeip.net/chameleon-customization/8.1/album.rss

    Gero  

  23. Joy Rumwir said...

    That link brings me to this site:

    http://gerodt.homeip.net/chameleon-customization/8.1/album.rss

    It appears to be a place where I can subscribe to that person's rss feed.  

  24. Gero said...

    Hi Joy,

    That problem was caused by the fact that my webserver was setting the contenttype of the album.rss file to "application/rss+xml" by default based on the .rss extension of the file. I've now configured the webserver such that is serves the file with contenttype "text/plain" and that should prevent your browser from interpreting the file as a RSS feed.

    If your browser still want to interpret the file as a RSS file use the following link:
    http://gerodt.homeip.net/chameleon-customization/8.1/album.rss.txt

    You now have to rename the downloaded file from album.rss.txt to album.rss

    Gero  

  25. Pregnant woman said...

    Hi, this seems a great way to share the photo with the friends with free hosting service. Thanks for sharing.  

  26. Anonymous said...

    Evaluation error on line 74:

    Details:
    Sourced file: inline evaluation of: `` linkEncode(getFolderUrl()) ;'' : Typed variable declaration : Void initializer.  

  27. Anonymous said...

    working great with 8.2.6 :) thanks a lot!  

  28. SEO cambridge said...

    This seems like a great idea! Thanks for sharing this.  

  29. andrewj said...

    Hi, I'm having a problem. I definitely have your updated album.rss file in my system directory, but I'm only getting the standard output when I make my album. I've set a webroot variable, but not anything else. Any idea what's wrong?

    My system is running Windows 7-64, Jalbum 8.0.9
    Thanks
    Andrew  

  30. andrewj said...

    Please ignore previous comment. I had a permissions problem on Win7.
    Thanks
    Andrew  

  31. andrew said...

    Hi,
    I have a different problem now. Slides which are in the top folder or one level below are fine (e.g. http://www.andrewj.com/album/Miscellaneous/slides/0709_40D_7723.html).

    However, for slides which are two or more levels below, the output doesn't include the "/" between the upper and lower folder, so the URL us wrong. e.g. http://www.andrewj.com/album/Venice%20CarnevaleSexy/slides/0209_40D_6913.html (this should be http://www.andrewj.com/album/Venice%20Carnevale/Sexy/slides/0209_40D_6913.html).

    Is there a way to fix this?
    Thanks
    Andrew  

  32. andrew said...

    Hi,
    I've found the bug which was creating broken links for albums with multiple levels on Windows.

    In linkEncode() you had:
    r.add("\\", "/");
    This would remove the backslash which is a key part of multi-level paths in Windows.
    I have replaced this with two lines:
    r.add("/\\", "/");
    r.add("\\", "/");
    I have also added the same code to entityEncode() to fix GUIDS.

    Please check and if you agree add to your master copy.

    Thanks
    Andrew  

  33. andrew said...

    Hi, did you get my post about the fix? The web page seems to be one post behind.
    Andrew  

  34. Gero said...

    Andrew,

    Thanks for fixing this issue. I'll include somewhere in the coming days.

    Regards,
    Gero  

  35. Anonymous said...

    Gero,

    I tried to download your modified album.rss, but the link does not work. Maybe the link ist lost after moving your blog to google. Can you please post the new link?

    Thanks
    Dietmar  

  36. Anonymous said...

    Hi Gero,

    When I click on this link:

    http://gerodt.homeip.net/chameleon-customization/8.1/album.rss

    It brings me to a page that says:
    /Users/gero/jalbum-utils/google-maps/album.rss

    Would love to try your album.rss. Do you have an updated link?

    Jason  

  37. Gero said...

    Apologies, the link should be working again now.  

  38. tim devine said...

    great job, gero.

    is there way to have the rss feed so new FOLDERS, rather than individual pictures? that would be a great tweak.  

  39. davidekholm said...

    Thanks for the work you've done to improving Jalbum's media.rss support.

    I'm the author of Jalbum. Would you like to continue to improve your template if I provide you with a variable that contains the album root URL? Please email to david_at_jalbum_dot_net for more info.  

  40. karel said...

    This works great!!

    tho i have some questions after using this method..

    1: if i use the original link to the feed i get to see xml coding only, so not the feed in all it's wonderous glamour..
    Can this be overcome somehow?

    2: Is it possible to style this method so it also includes previous (other) albums?
    We dont use 1 album with subfolders but multiple albums, and would like to see them all in 1 rss-feed with the images using your scripting. Can it be done?

    thanks in any case for all your work on Jalbum, we're new to it.. and not exactly scripting guru's so finding your blog was a heavens sent..
    Greets,
    Karel.  

  41. mimasan said...

    Hi Gero, thanks for your work!
    You said,
    "3.Add a user variable 'webroot' to your JAlbum project."

    Please teach me how to do this.  

Post a Comment