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:
- the fact that the generated feeds contains relative URLS (and RSS requires absolute URLs)
- 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?
- Make a backup of the Jalbum/system/album.rss file. This is the original template file.
- Download the updated album.rss file and copy it to Jalbum/system directory
- 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)
- (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.
- --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
Earlier this year (see here and here) I made an integration between the JAlbum Chameleon skin and Google Maps. This would show an in-page Google Map for pictures that have GPS coordinates. Works really nice. Recently I wanted to create an RSS feed of my webalbums and noticed that the latest JAlbum version did support this. Nice, so I decided to upgrade JAlbum to version 8.1 and as part of that also had to tweak my enhancements to the Chameleon skin a bit.
If you're interested... you need to copy the following two files to the JAlbum/skins/Chameleon directory:
You also have to set the following two user variables (Settings/Advanced/User Variables):
# The root where the webalbum will be hosted
webroot=/webalbums/gero
# The location of the HTML page that displays the map and
# has the Google Maps code in it
# This location is bound to the Google Maps API key.
googlemapIframe=/webalbums/googlemap.html
For a full description on what how to use the Google Maps - JAlbum integration refer to the earlier posts (here and here).
Now there was one dissapointment... the feed generated by JAlbum cannot be handled by Google Reader and NetNewsWire. Will try and tweak the JAlbum template that generates the feed such that it works correct and post the results here.
Labels: googlemaps, jalbum, webalbum
A while ago I described a nice way to integrate Google maps in the JAlbum Chameleon skin. One of the readers of that blog entry tried it on JAlbum version 7.4.1 and too my surprise it did not work. It appeared that the way I was retrieving the two extra variables from the JAlbum album project file was not forward compatible with version 7.4.1 (I developed it using JAlbum 7.3). With some help in the Chameleon skin forum I've now fixed it.
To use it you can still follow the description in the original post, but use the following two files:
# The root where the webalbum will be hosted
user.webroot=/webalbums/gero
# The location of the HTML page that displays the map and
# has the Google Maps code in it
# This location is bound to the Google Maps API key.
user.map.iframe=/webalbums/googlemap.html
Labels: googlemaps, jalbum, Java, webalbum
Finally found some time to play with Google Maps. It is shockingly easy to create something with it and I decided to integrate it into my webalbum. I'm using JAlbum to generate a website for my photo's and using the Chameleon skin you generate a decent website easily. The Chamelon skin already links to Google Maps, but in a separate pop-up window and I wanted to have the map info next to the photo's themselves. Another feature I wanted was to have an overview of all photo locations on the index pages. Using the Google Maps API and by tweaking the Chameleon skin this was pretty easy to accomplish.
First challenge I had to solve was one related to Google Maps. When you sign up for the Google Maps API you get a API key that must be included in the pages that display a map. This key is bound to 1 directory and since most photo albums are organized in some form or directory structure that would require a new API key for each directory. Not very practical, especially when you use a automated process to organize your photo's by date of subject like me. The solution to this was to display the map in an iframe, this iframe is then included on the web album pages and because it is always the same page displayed in the iframe, it is possible to use 1 Google Maps API key. By including a couple of parameters (map width/height, coordinates, url of KML file) the contents of the map can be controlled by the page including the iframe.
Another challenge was not including hardcoded addresses in the templates. For a long time I was able to keep hardcoded addresses out of the solution, but in the end it became necessary to know the location at which the generated webalbum would be hosted. Reason being that the page containing the Google Maps scripts that is used in the iframe may be at a different server/location then the webalbum. However, for the index pages the Google Maps code needs to retrieve a KML file from the location where the webalbum is hosted and therefore needs the exact address.
Two properties have been added to the JAlbum project file:
# The root where the webalbum will be hosted
skin.webroot=/webalbums/gero
# The location of the HTML page that displays the map and
# has the Google Maps code in it
# This location is bound to the Google Maps API key.
skin.map.iframe=/webalbums/googlemap.html
Both of the above properties could include a host name, but since I'm hosting everything on the same server that was not necessary for me.
The rest was pretty easy. JAlbum uses some template files to generate the webalbum pages and in these templates you have access to the details of the photo(s) being displayed. On the index template (index.htt) this information is used to generate a KML file of which the URL is passed to the iframe. The index pages display 1 marker for all photo's at the same location, when clicking the marker the balloon shows thumbnails of all images at that location. Clicking on one of the thumbnails takes you to large version of that photo.
On 1 photo template (slide.htt) the information provided by JAlbum is used to pass the coordinates of the current image.
There is probably some optimization possible (see also comments in the index.htt, slide.htt and googlemaps.html file), but getting this first version to work was great fun and really easy. The changes made to the standard index.htt and slide.htt file can be easily identified by searching for 'GOOGLE MAPS'.
Want to see what it looks like? Go here.
Labels: googlemaps, jalbum, webalbum





