During the last six months I advised a student on her project for her diploma thesis which, of course, involved scsh. It’s a web-application for sharing, organizing, storing, displaying, and manipulating images. Think of it as an crossbreed of applications like iPhoto, ImageMagick, and flickr.com. Completely written as Scheme SUrflets. To my knowledge this application, named PhotoBase, is the largest SUrflet application so far (16000 LOC).
The basic idea is that users can upload their images either via HTTP-upload or by choosing an directory in the server’s file-system into an archive. This archive is basically some hierarchical directory structure on the server. The archive is accessible for registered users only. An administrator grants an user the right to create photo albums from the archive pictures. The idea is the following: the archive stores an immutable original copy of the image and albums contain selections of maybe modified images of the archive. An user may grant the right to view and comment the pictures of an album to other users, user groups, or the public. Albums may be static or dynamic. Dynamic albums are basically SUrflets which allows the application to do all the stuff like displaying comments, searching for photos and so on. A static album is just a directory full of image files and HTML files. Thus, works on all web-servers. Albums are generated by templates, i. e. module that is expected to implement a certain interface. PhotoBase has two neat standard templates. However, it’s very easy to write new templates.
Besides the albums there is a web-based image editor. This editor displays the image to be edited along with some widgets to modify the image such as buttons for resizing, rotating, enhancing contrast, and lots of other stuff. The server uses ImageMagick to actually carry out those operations. The editor also has an “undo preview bar” which displays a thumbnail version of the image in a certain state of manipulation. Clicking on such a thumbnail returns to that state of the image. A sequence of these operations may be safed as a “batch program” and applied to a set of pictures at once.
An user may add meta information to a picture such as all kind of descriptions (place, people, etc). In fact users define a set of meta data fields that are stored for a photo and may enter that information themselves or let other users edit this information on the album pages. Next to this user-specific meta data, there is also global meta data stored in the archive. This information includes the exif information read by ImageMagick’s identify program and a tag (for searching).
PhotoBase stores meta data as S-expressions in files, so there is no database involved. To keep the access to the information fast, a seperate thread reads the meta data from disk and waits for request on a synchronous Concurrent ML channel. Thus, all SUrflet instances share one thread that keeps the data for them. The server thread also saves the information to disk at regular intervals.
Three things need to be done before an initial release of PhotoBase:
- Review and committ some patches for SUnet needed by PhotoBase (HTTP upload, for example)
- Make it easier to specify where PhotoBase stores its archive
- Provide an install-script
That’s not an awful lot of work…
Technorati Tags: Scheme, PhotoBase, Concurrent ML channel, EXIF, scsh, SUnet