Familien Schøler’s blog

Lidt af hvert fra hverdagen hos Michael, Kamilla, Marie og Katrine Schøler

Task scheduling for auto updating your JAlbum web albums

Hello JAlbum users,

I’m managing an ever growing collection of personal photos on a password protected section of my web page. To simplify and ensure the best experience for the photo album visitors, I’m of course using JAlbum. The problem is, JAlbum does not handle VERY large photo album structures all that well, mainly because its not directly intended for that. It is intended for quickly and painlessly publishing one or more photoalbums directly to a local www or FTP folder.

My families root photo album structure currently contains 25000+ images (approx. 75 Gb) dating back to 2000 (where I bought my first digital camera). And I’ve managed to set it all up so that JAlbum runs smoothly and fast for each new month that passes. Quite amazing!

The trick is of course to divide and conquer by placing photos in seperate folders, each using its own JAlbum project file. But that also means managing a steady growing collection of JAlbum project files. What to do?

I have all my raw photos grouped in subpaths on a USB harddrive as “H:\Data\Fotoalbum\YYYY\MM\…”, and I publish the albums to my web server running on a different harddrive (P:\Xampp\htdocs\YYYY\MM\fotoalbum\…). This gives a nice file structure and good permalinks to the online albums.

To continously update the albums, I’ve setup a simple scheduled task which triggers a bat file that generates the needed JAlbum project files and executes them automatically. Furthermore, the bat script generates an update bat script that is placed along side the generated JAlbum project files.

The bat script for the task scheduler looks like this:

@echo off
echo JAlbum processing h:\data\fotoalbum\%date:~6,4%\%date:~3,2%\ folder...
IF NOT EXIST h:\data\fotoalbum\%date:~6,4%\%date:~3,2% GOTO NODIR
  echo Album for specified month exists.
  echo Generating JAlbum project file based on template...
  h:
  cd h:\data\fotoalbum\
  echo #Task scheduler - Auto generated JAlbum project file> album.jap
  echo directory=H\:\\Data\\Fotoalbum\\%date:~6,4%\\%date:~3,2%\\>> album.jap
  echo outputDirectory=P\:\\xampp\\htdocs\\%date:~6,4%\\%date:~3,2%\\fotoalbum>> album.jap
  echo interpretedOutputDirectory=P\:\\xampp\\htdocs\\%date:~6,4%\\%date:~3,2%\\fotoalbum>> album.jap
  type jalbum-settings-template.jap >> album.jap
  copy album.jap h:\data\fotoalbum\%date:~6,4%\%date:~3,2%\jalbum-settings.jap
  del album.jap
  echo Generating photo album with the JAlbum command line tool...
  c:
  cd "c:\program files\jalbum\"
  java -jar JAlbum.jar -projectFile h:\data\fotoalbum\%date:~6,4%\%date:~3,2%\jalbum-settings.jap
  echo Copying website specific files to output www folder...
  copy h:\data\fotoalbum\index.html P:\xampp\htdocs\%date:~6,4%\%date:~3,2%\
  copy h:\data\fotoalbum\.htaccess P:\xampp\htdocs\%date:~6,4%\%date:~3,2%\fotoalbum
  echo Generating update script...
  echo c:> h:\data\fotoalbum\%date:~6,4%\%date:~3,2%\update.bat
  echo cd "c:\program files\jalbum\">> h:\data\fotoalbum\%date:~6,4%\%date:~3,2%\update.bat
  echo java -jar JAlbum.jar -projectFile h:\data\fotoalbum\%date:~6,4%\%date:~3,2%\jalbum-settings.jap>> h:\data\fotoalbum\%date:~6,4%\%date:~3,2%\update.bat
  goto ENDING
:NODIR
  echo Album for specified month was not found.
:ENDING
  echo Done.

[Download the script]

The most basic part of the bat script is “h:\data\fotoalbum\%date:~6,4%\%date:~3,2%\” which transforms into “h:\data\fotoalbum\2010\07\” for instance at any given day in July month of 2010. By using these “macros” the script is able to run time and time again, and always update the current months photo album folder. I’ve set the script to be run each day for now, ensuring that my albums are always up to date on the web page (provided I remember to actually take and upload new photos).

When the script runs it does several things:

1. Check that the current months album folder actually exists, if not, it stops and waits for the next scheduled run.

2. If the album exists it creates a file called “album.jap”

3. It fills in the following lines in the top of that file (based on the current year/month):

  #Task scheduler - Auto generated JAlbum project file> album.jap
  directory=H\:\\Data\\Fotoalbum\\2010\\07\\>> album.jap
  outputDirectory=P\:\\xampp\\htdocs\\2010\\07\\fotoalbum>> album.jap
  interpretedOutputDirectory=P\:\\xampp\\htdocs\\2010\\07\\fotoalbum>> album.jap

4. It then appends a template project file (jalbum-settings-template.jap), that I’ve already setup using the JAlbum UI. Basically setup any skin and various settings you want for your photo albums, and save it. Then just delete the three lines from above (“directory=…”, “outputDirectory=…” and “interpretedOutputDirectory=…”) and save that new project template file as “jalbum-settings-template.jap”.

5. The generated JAlbum project file is then copied into the photo album source folder (will be placed as “h:\data\fotoalbum\2010\07\jalbum-settings.jap” in this example), for later possible manual reinvocation / updates by you.

6. A number of website specific files are required on my site, and the bat script now copies these files into the output folder. For my site its a root index.html file that directs the “previous album” link from the index page of the album back to a search page I’ve made (that’s for a comming blog post). Also it places a .htaccess file that requires visitors to enter a login and password when browsing the album. This can be left out, or entirely customized for your sites needs.

7. Finally it runs the generated project file against the JAlbum command line tool, and finished off by saving an “update.bat” file in the source folder “h:\data\fotoalbum\2010\07″. When ever you want to manullay re-publish the album you simply activate this bat script, or you can go into the JAlbum UI and load the “jalbum-settings.jap” and publish from there.

Hope you find this useful.

Best regards
Michael

JAlbum plugin for WordPress is hereby no longer updated

Hey there

WordPress 2.7 has just hit the street, and it’s got a fancy new admin interface with many improvements… And once again, it is not fully backwards compatible. So… I’ve given up the fight. The JAlbum plugin for WordPress v2.5 didn’t even reach a release state, and I’m not up for another round of tweaking to be compatible with yet more interface changes.

As the plugin is open source, you are more than welcome to take over where I left the dang thing – hanging in a near release state, for WordPress v2.5.

Signing out.

Michael Schøler

JAlbum Plugin for WordPress – download links for beta and previous version

JAlbum plugin for WordPress...

Hi there

You’ve all been far too patient, and I’ve been far too busy (with just about everything else than the plugin).

Bottom line: I’m not done with the latest version of the plugin – yet – but you can now download the beta version from my site and just install it for the first time or upgrade your old v1 of the plugin. Your old v1 albums will continue to work.

Having the beta and v1 installed at the same time is “ok”, as long as only one of the versions is active in the wordpress plugin manager.

The beta is still missing the new “Upload Jalbum project file” feature and the new JAlbum manager section is also to be considered work in progress. However, all the old features are present and functioning – so just use it as you’ve always had. On the plus side, the beta version is compatible with wordpress 2.5+ and as some of you might have noticed the v1 plugin wizard interface died at 2.5 due to a major upgrade of the wordpress TinyMCE editor.

I’ll throw whatever time I can find at the plugin, currently its looking grimm, and would love to hear from some of you about your modifications/additions/further work on the plugin. It is open source, so feel free to contribute! =)

Download beta version of the plugin.

Download the previous plugin version.

Vacation time = no JAlbum plugin for WordPress time

Hi

As I’ve been busy for a couple of weeks leading up to my current vacation I’ve not been putting any hours into the plugin recently.

I’ll resume the work again some time in August.

Thanks for all your feedback, you’re keeping me busy and I’ve received many good ideas for improvement and future versions.

Best regards
Michael