Photo Finishing Products and services

PictaTrove

Copyright 2008 by Stephen Vermeulen
Last updated: 2008 Oct 12
Pipeline Industry





120px above accounts adds again along areas cellpadding come complete configuration currently custom div downloads edit family feb generating generator groups head hosting hr imaging india industry let lets listing log mainly members message necessary note pictatrove produce publishing quickly reason remove return script select sept sheet shutdown sub try until wants whole

Photo Sharing Server News

  • 2008-Aug-22: Photosynth is Microsoft's experiment in turning photos into an immersive 3D world view. More discussion on this here on Slashdot. This went live in Aug'08. [4462]
  • 2008-Mar-01: National Geographic have launched their My Shot site, a photo sharing site that allows you to submit photos to National Geographic's Your Shot feature. [5203]
  • 2008-Feb-27: picurl is an application (written in Python) that attempts to unify a set of separate photo storage sites (including disks, removable media and web based photo sharing sites) with the goal of making photo storage, query and access uniform. [5178] [1]
  • 2008-Feb-22: The 2pad Online Gallery is a photo sharing site that emphasizes user control of who has access to your photos. [5135]
  • 2007-Dec-18: Shozam! is a web gallery generator [4461]
  • 2007-Dec-18: PhotographyBLOG discusses how people share their photos [4460]
  • 2007-Dec-18: Newscorp is purchasing Photobucket (May'07) for 250-300 million dollars. Apparently they have about 41 million subscribers and are hosting about 2.8 billion images. [4459]
  • 2007-Dec-18: A podcast interview of Antonio Rodriguez the founder of Tabblo on photo albums and social networks [4458]
  • 2007-Dec-18: Slashdot discusses Flexible Photo Organization Software [4457]
  • 2007-Dec-18: Vista's Photo Gallery embeds image annotations into the image (at least for JPEGs) as XMP formatted XML data. [4456]
  • 2007-Dec-18: How to handle image metadata (auxiliary data about the images) such as EXIF information and user entered notes [4455]

Introduction

PictaTrove is a small, dedicated, web server that allows one to share a selected set of photographs over the web. It works for both Windows and Linux platforms.

PictaTrove was written with the assumption that the site administrator (sysop - system operator) would have a large set of unedited photographs already organized in directory trees and that he wants to publish some selected sub-sets of these.

PictaTrove evolved from my earlier work with PhotoTrove, which went through about three major versions before undergoing a redesign to simplify the configuration and administration of the program. At which time PhotoTrove became PictaTrove.

PictaTrove is a standalone web server, written in Python that dynamically builds photo-gallery web pages out of original photographs. It does a number of things, such as:

  • builds all the necessary HTML on the fly
  • creates the thumbnails
  • creates a medium sized preview image (such as an 800x600)
  • extracts some EXIF data and displays it
  • adds user annotations (such as a title and description)
  • creates a full-sized image (which can be delivered at reduced quality to save bandwidth)
  • adds watermarks
  • allows one to build different sites or shows (for different audiences) from the same input. For example you might have all your photos for a given month in the same folder and there are some you want to publish for people at work, others you want to publish for your relatives around the world and others you want to publish for the whole web.
  • does not modify or move the original source photographs
  • provides separate sysop-only and general-user interfaces to simplify administration and security
  • allows the sysop to create his own custom general-user interface to achieve the web look he wants
  • provides some additional photo-serving query URLs that allow photos to be placed on web pages on another web server
  • provides digest-authentication of users, users are organized into groups and access is granted on a slides show by slide show basis
There are a lot of configuration options, but a simple site can be built without entering any additional data, so you can get started quickly.

At the time of first publication (6 Aug 2006) PictaTrove was not returned by a Google search! On 11-Aug-06 Google returned the first hit, which was for the domain name registration.

Sample Slide Shows

Here are some example slide shows that will give you an idea of what PictaTrove can produce (this is the general-user interface). Whenever the current page is loaded or refreshed the two thumbnails below will display a different photo from each show at random (this is a feature of one of the query URLs that the PictaTrove server supports).

A short slide show of a hike in Bow Valley Springs provicial park (Alberta, Canada) from May 2005.

A longer slide show containing photos I took on a business trip to Mumbai and Vizag, India.

License

This is free for use, a shareware version in C++ for Windows may be available later.

Downloading

The current version of PictaTrove is available in this zip file: pictatrove2007-01-01.zip. See release notes below.

Installing

For the first versions you will need to install the Python environment on your computer, along with a support package known as PIL, the Python Imaging Library. To install these things you should download their installers and then just following the installation instructions. I have written this using Python 2.3, and it should work with newer versions of Python too. You can find the appropriate install packages here:
  • PIL for Windows can be found prebuilt on this page, the link you want for Python 2.3 is this.
  • Python is available for many platforms, this link gets you the pre-built version 2.3 for Windows.
You need to install Python first and then install PIL.

If you are going to run this on Windows then you must also install the Python Win32 Extensions package, the install kit can be found on this page.

Once you have done this you can install my PictaTrove program [zip file]. Just unzip the contents of this to some handy directory (I used E:\temp\picta in the example below) and the installation is complete. This directory will contain some Pyhton files (*.py) a config.ini file and some subdirectories. As a test you should be able to start the web server by just running:

python appserver.py

At this time and then start a web browser and connect to http://localhost:8881 you should get a simple page with some broken links. As well some web server activity log output should be written to the console:

E:\temp\picta>python appserver.py
Log directory: 'log' does not exist, logging disabled
2006-08-09 12:58:17 - 0 - appserver started
2006-08-09 12:58:17 - 0 - read config file
2006-08-09 12:58:17 - 0 - Made new slideshows directory 'supportdata/slideshows'

when you create a "log" directory this will be sent to a log file in that directory.

Next, shut down the server, and add a sysop user to the list of accounts (which is in accounts.txt and is currently empty). Use the commands:

mkdir log
python user.py +user somename somepassword
python user.py +group somename sysop

The first command creates a directory for log files to be written in. The second command creates a user (called "somename" and gives him a password) an MD5 digest version of this is stored in the accounts.txt file. The third command adds the sysop group to the user's account record.

Tour of the Sysop Interface

Now restart the server and enter the URL: http://localhost:8881/contact?dir=/photos into your browser. You will be prompted for a username and password, enter those for the sysop account you just created and you should now get a contact sheet view of some sample photos (these are stored in the "data" directory that came with the pictatrove zip file, but are displayed as if they are in the web directory "/photos").

Note: PictaTrove does not modify any of the original photos, if you need to annotate, rotate, resize or crop photographs it will make a new version based on the original on the fly and save this new version in a cache directory, from the cache directory it will be sent out to the web browser.

The contact sheet gives you access to the directory tree of photos, you can go up the tree by clicking on the up-icon and enter sub directories by clicking on their names. As well, the contact sheet allows you to access a larger view of each photo (the details page) by clicking on the photograph's thumbnail image.

The contact sheet also has some additional links:

  • "Slide Shows" takes you to the slide show listing page
  • "Sysop Functions" takes you to some additional administration functions
  • "Logout" will log you out, in case you want to switch to a different user ID to test
  • currently the search is not working.
Click on the right most photograph (the one of a mountain lake on its side). This will take you to the details view so you can rotate the photo properly.

Details Page

The detals page for any photograph allows you to do some simple editing and annotation functions. To fix the rotation click on the "Rotate CCW" (CCW stands for counter clockwise) button. If you now return to the contact sheet (by clicking the up-icon) the contact sheet will also be updated.

The "Edit XML" button allows you to add titles and descriptions to the photograph.

The "Edit Photo" button allows you to crop the photograph (or remove or change existing cropping). This functions by using a Java applet in the web browser to select the cropping area - for this reason you will need a browser that allows the running of Java applets. Note this applet can sometimes take about 10 seconds to start, and sometimes the image does not appear until you wave your mouse over the browser or resize the browser window.

The "Add to show" button is used to add the currently displayed photograph to the end of the default slide show - see the next topic.

Creating Slide Shows

To create a slide show you will need to go to a contact sheet page and then click on the "Slide shows" link at the bottom of the page. This will display the "Slide Show Listing" page, to create the first slide show enter a name (say "test1") in the "Add new show" text field and then click on the "Create show" button. Once the show is created you need to make it the default show (by clicking on the "set as default" link - which will highlight it in the table) so that the "Add to show" button on the details pages will work.

Now hit the "Home" link to go to the topmost contact sheet and then select the first photo, click on its "Add to show" button. Doing this will add the photo to the slide show and also take you to the details page of the next photo in the directory. Click on the "Add to show" button again.

You now should have a slide show with two pictures in it. At this time go back to the slide shows listing page and the slide show table should now show a thumbnail image of a random slide in the show. Click on this image to see the show. You can use the edit link in the slide show table to change settings relating to the slide show (such as image sizes).

Use the show edit function to add a group called "public" to the groups that are allowed to see the show - the public group is a special group that does not require the user to log into any account to see a show's contents.

Now close your browser and restart it - this is the best way to make sure you have changed accounts. Then go to the URL http://localhost:8881/slidelist? you should now see a slightly different view of the list of slide shows, with no editing capability, you can click on the first slide show to see it as a public user, and the few pictures in the slide show should be all the public user has access to.

Creating additional user groups

You can create additional user groups to control access to slide shows and the regular HTML page areas if you need to. There is always a built in "public" group which needs no authentication (so is suitable for links that should be available to anyone on the web). There is also a built in "sysop" group. The config files that were included also define a third group "family".

Groups appear in the [access] area of the config.ini file, where you will see lines like:

[access]
/photos=sysop
/familycache=family
/sysopcache=sysop
/publiccache=public
/extras=public

what this section means is that URLs which start with "/photos" are only accessible to members of the sysop group, those that start with "/extras" are accessible to everyone (with or without authentication). Note the "/extras" area is where things like the up and down arrow icons and the top level index.html file come from.

The three URLs with "cache" in them establish who can access which cache directory.

In the pt/config.ini file there is a [groups] section which lists the groups and the names of the cache directories used for each.

Publishing Directories

Once you have the test system running you will probably want to reconfigure it so that it can publish an existing directory tree of your photos. To do this you will need to edit the [roots] and [access] areas of the main config.ini file. By default these look like:

[roots]
/photos=data
/familycache=familycache
/sysopcache=sysopcache
/publiccache=publiccache
/extras=extras

[access]
/photos=sysop
/familycache=family
/sysopcache=sysop
/publiccache=public
/extras=public

Lets say you have a photo collection that starts in the directory C:\mydata\photos, you can replace the existing mapping by just changing the [roots] area to look like:

[roots]
/photos=c:/mydata/photos

you should just leave the access set to sysop. Then restart the appserver and you should be able to build slide shows based on this set of photos.

If you have photos that are stored in other directory trees as well, perhaps on other drives or even on other machines you can add additional lines for them. Note that there is only one "default root" which is configured in the pt/config.ini file as "rootdir=/photos", this is used by the "Home" link, so if you have multiple directory trees you might want to edit the index.html file to include entry points for them for your browsing convenience. In the following example I have added two more roots, one called "/oldphotos" and the other called "/olderphotos", the "/olderphotos" is even located on another machine in a share called "cdrive" (which should work but I have not tested... a mapped drive letter will also work).

[roots]
/photos=data
/oldphotos=d:/some/old/photos
/olderphotos=//servername/cdrive/very/old/photos
/familycache=familycache
/sysopcache=sysopcache
/publiccache=publiccache
/extras=extras

[access]
/photos=sysop
/oldphotos=sysop
/olderphotos=sysop
/familycache=family
/sysopcache=sysop
/publiccache=public
/extras=public


Running

On Linux

For a short term test you might just want to start the server manually (as above), but eventually you will want it to start at boot time. There are a number of ways of doing this, here is one of them. Create a small shell script to start pictatrove:

#!/bin/sh
cd /home/tools/picta
python appserver.py &

Then in the /etc/init.d directory you will find some scripts for starting and stopping services, among these might be an example (under Debian this is called "skeleton"), you can modify a few variables near the top (DESC, NAME, DAEMON) to reference your script to start PictaTrove and then save as a file called "picta". Do a "chmod" to set up the execute and read permissions so it matches the other scripts in that directory. Then go to the directory /etc/rcS.d and make a symbolic link to it, naming it something like S85picta, the command to do this would be "ln -s /etc/init.d/picta S85picta"

To test to see if you've got it set up you can try "/etc/init.d/picta start" to start it running.

The big test to see if this has been configured correctly is to do a "shutdown -r now" and reboot the system to see if the server starts by itself when the machine finishes the reboot.

On Windows

Once you have determined the server works correctly from the command line, you may want to configure it so that it runs as a Windows service, and thus is available whenever the machine is running (even if no one is logged in).

to do this one needs to make a number of paths absolute, and modify a line in appserver.py and in service.py... details to follow soon.

One Time Pad

As PictaTrove does not currently support SSL connections I have implemented a one time pad system to protect passwords that are remotely entered when new accounts are created or old accounts edited. Note: this does not apply to the normal password entry that is used for user authentication as that is already well protected by the browser-based digest authentication protocol.

Before you can use most of the remote user administration functions you will need to create a one time pad. To do this you run the makeotp.py program, with a command such as:

makeotp.py c:\some\directory\of\lots\of\files

The program will search the directory tree, and if there are enough files of at least 8K in size then it will proceed with generating a file called otp.txt in the current directory. You then need to modify the config.ini file to add a line like:

otpname=otp.txt

to the [server] section so that the server can locate the one time pad when it needs to decrypt something.

If you ever do so much editing that you use up all the keys in the one time pad (or you believe your one time pad has been compromised), then you will need to generate a new copy of otp.txt and reset the server's idea of what has been used, which you can do by stopping the server, erasing the file: nextotp.dat, and restarting the server.



Release Notes

  1. 9-Aug-06 initial testing release, zip file: pictatrove2006-08-09.zip, added samplePres3 with new slideshow details layout, fixed the issue with user.py not running while appserver.py is running
  2. 23-Aug-06 fixes, zip file: pictatrove2006-08-23.zip, to address a number of issues and added initial support for use with AJAX style front ends. If you already have a version installed just copy across all the *.py files, and when you restart the appserver it should update any slideshows you have made automatically. Fixes include:
    1. lots of changes to the slide show listing page, added delete, rename, description and titles, keywords and filtering
    2. some changes to the show editing page, now shows thumbnail of each slide and changed the remove function to a link
    3. restructured slide shows internally so that filename is no longer used as a unique key, allows you to add the same picture to a show more than once, plus the filename is replaced by a number in the URLs
    4. fixed an issue with making thumbnails of "palette-mode" images (such as GIFs), these should now work
  3. 27-Aug-06 fixes, zip file: pictatrove2006-08-27.zip, to address a number of issues and add more functions. If you already have a version installed just copy across all the *.py files. If you have installed a previous version be sure to read this note first, as config.ini has changed a bit and you will need to update your copy.
    1. the pt/config.ini file has been removed, the configuration records in it have been moved to the [pictatrove] section of the main config.ini file. See the sample config.ini file for the change in the way the groups are defined.
    2. a debuglevel= item has been added to the [pictatrove] section, this sets the debug level that will be applied when the server is restarted.
    3. the presentation python files must now be named in the config.ini file, with presname.n= records. This way the server can find them and display their names in pick lists. The [addon] section can be removed as it is no longer needed.
    4. The add show form will strip off leading and trailing spaces, will not let you enter a duplicate name, will not let you enter an empty name and now has a drop list for the valid presentation choices (see the previous item).
    5. In the sysop's details view a list of the slide shows a picture appears in will be displayed (if a picture appears in a show twice it will be listed twice)
    6. The problem with subdirectory names that match the root directory names has been fixed
    7. If a sysop views a slide show, the details view display will now have the photo editing buttons on it. When you do an edit with these (such as rotate a photo) the regular sysop details view will appear after the edit is applied, to get back to the slide show hit the browser's back button.
    8. The one config.ini file can be edited now, and almost all changes will take effect right away (upon saving the changes). The main things of note are that you can change the root directories and access settings.
    9. The sysop functions page now displays the current and recent past log file names, you can click on these to view them. The appropriate virtual root (/logfiles) and security ("sysop" group only) is added automatically so does not need to be configured in config.ini
    10. You can edit the presentation file that a slideshow uses. If your slideshow appears broken afterwards check to see that the new presentation python file actually exists in the main directory and is spelt correctly in the presname record of config.ini.
    11. The previous version had a problem with the links from details to full size images in slide shows getting mixed up if photos were removed from slide shows. Fixed.
    12. Some of the GIF images still were not working. This has been fixed, but if you still see broken GIF images, look in the cache directories for zero length files and delete them, of just use the empty cache sysop function.
  4. 7-Sept-06 fixes, zip file: pictatrove2006-09-07.zip, mainly to add some user account functions, to allow for creation, modification and deletion of user accounts through the web interface. If you have already got a PictaTrove installation just copy across the *.py and pt/*.py files. Note some of these functions use javascript so you need to enable that in your browser. Some more work on the AJAX support interface, still not in final form though. The config.ini has a new line in the [server] section: otpname=, this tells the server where to find the "one time pad" file, which is used to encrypt passwords you enter for new accounts or when you are changing a user's password - this is being used as SSL is not implemented at this time. To generate a one time pad file you need to run the "makeotp.py" utility. See the One Time Pad section (above) for more details.
  5. 1-Jan-07 fixes, zip file: pictatrove2007-01-01.zip, various fixes:
    1. mainly to fix the login/logout function, this actually requires some JavaScript in the browser to be executed to get the browser (Firefox and Seamonkey mainly) to forget the current login, as well the server resets its state a bit to prevent the previous credentials from being reused. Now works with Seamonkey 1.0.4, Firefox 1.5.0.9 and MSIE 7.0. These changes also (mostly) work around a known bug in Firefox and Seamonkey (Bug ID: 220022).
    2. removed the "name=" line from the config.ini file as it was no longer used for anything
    3. added a footer to all pages with a link back to the pictatrove.com site
    4. in the sysop mode (contact and details views) there was a "Copyright 2006 Stephen Vermeulen" message, this came from the default settings of the sysopSettings.py file. Now this has been changed to remind you to edit the sysopSettings.py file to put the message you want in.

Additional Suggestions for Improvement

This section lists some suggestions for improvement in PictaTrove that have been received from other users. There's no promise that I'll do any of these things, but unless I've specifically stated I'm not going to do something, there is a chance that I'll address these in some future version.



              back to vermeulen.ca home