Gallery2 Album Upload to SmugMug in Perl

Description|Requirements|Inputs needed|What this script does|License|Download|Feedback/Help


This perl script can help you upload your images from you Gallery2 to SmugMug.
It is based on Jeremy Mooney's FileUpload for SmugMug. Jeremy graciously agreed that I can extend his script and release it in this version specialized on Gallery2. Thank you! If you just want to upload single files in an automated fashion or have iphoto albums to upload, check out his website.


Inputs needed

There is two ways of putting the required parameters in: The config file (downlaod the template "uploadalbum.cfg) or via the command line.

Example call:
./uploadalbum --directory /home/user/g2data/albums/travel/brasil07 --database DBI:mysql:databasename_g2:localhost --dbuser user --dbpass pass --email --pass smugpass

You can easily upload all albums in your gallery using the find command (specify all other required parameters in the config file):
find /home/user/g2data/albums -type d -exec ./uploadalbum --directory {} \;
(the last two characters are a backslash followed by a semi-colon)

What the script does

  1. Check if the specified directory is valid, readable and under albums
  2. Login to SmugMug (https)
  3. Log into mysql db
  4. Finding the id of the album that is stored in the specified directory
  5. Creating a new album on SmugMug with the specified CategoryID, unless an AlbumID was specified
  6. Looping over all the jpeg files in the directory
  7. Looking up the title for each one, defaulting to the filename if missing
  8. Upload the file to the Album, continue with the next image
  9. Logging out the SmugMug Session


Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.


You only need the main file uploadalbum (right-click 'Save Link As'), but I recommend you also get the config file uploadalbum.cfg to go with it (the command line tends to get very long).


I do not promise to support this script or that I will always keep it up to date, when Gallery or SmugMug change things on a greater scale. However, if I have the time, I will do what I can to help you. Just drop me an email at marco (ät) marcofrom (döt) com.

Alternatively, you can check out the Digital Grin Forum Thread.