photoindex ========== `photoindex' is a simple Java program for consutructing HTML index pages for directories containing pictures in JPEG format. For each directory, the program creates a thumbnail for each picture, and an entry in an HTML index page. These index pages and thumbnails allow the pictures to be browsed conveniently using a Web browser, as clicking the thumbnail loads the full picture. By pointing a Web browser at `index.html' at the top of the directory hierarchy you can browse all the pictures by their thumbnails. photoindex places the indexes in files called `index.html' in each directory in the hierarchy. This makes it possible to point the browser at any directory in the set, not just at the top-level directory. I wrote this program to make it easier to browse photos captured with a digital camera. Although software to do this is supplied with most cameras it (a) is not very flexible and (b) usually only runs under Windows. photoindex is a Java program and should run on anything. Because it can take a long time to process a large set of images, photoindex checks the timestamps of the source pictures and the generated files, and only updates the generated files if the source has changed. Usage ===== photoindex is designed to be run from the command line, with the directory specified as a parameter. The directory and all its subdirectories are processed recursively. usage: java com.web_tomorrow.photoindex.Main [directory] Make sure the jphotoindex JAR (photoindex.jar) is on the CLASSPATH This will create thumbnail pages and index HTMLs in each directory and subdirectory. Templates ========= To customize the appearance of the HTML pages, photoindex supports a simple template mechanism. In each directory it examines, it looks for a file called `photoindex.html'. If it is found, this is used for the template. A simple sample template is provided in this archive. photoindex looks for various application-specific tags in the template, and substitutes them as follows: replaced with thumbnails of the images replaced by links to subdirectories replaced by the page title (see below) replaced by the navigation links (see below) replaced by the navigation up-links (see below) Templates propagate down through the directory hierarchy, so if all index pages are to have the same layout, it is only necessary to edit the template for the top-level directory. There is a default template, but it is very simplistic; I recommend creating at least a top-level template. Properties files ================ photoindex takes no command-line arguments because it recognizes that most, if not all, configuration options may need to be set on a per-directory basis. photoindex reads the file `photoindex.props', if it exists, in each new directory. Settings in this file override those set the in parent directory, if any. Currently the following properties are recognized: thumbnailwidth (integer, 100) the width in pixels of a thumbnail thumbnailheight (integer, 100) the height in pixels of a thumbnail thumbnailsacross (integer, 4) the number of thumbnails shown in each row on the index page verbosity (integer, 1) amount of debugging info to generate. 0 = errors only 1 = error and warnings 2 = errors, warnings, and info title (string, directory) page/directory title showfilenames (integer, 0) 1 = shows the filename for each thumbnail 0 = no filenames The properties in a given directory are inherited from the directory above when it makes sense to do so. The following properties are _not_ inherited: title Titles ====== photoindex understands the concept of a page title, although it does not process the title in any way. The title is either a string specified in the properties file, or the last part of the directory name. Therefore, if your directory names are sensible you may not need to specify titles explicitly. When generating the index file, photoindex simply passes the page title to the output in place of the `' tag. Filenames ========= photoindex can display the filename under each thumbnail; the default is not to. It is only useful to display the filename if it makes sense; camera-generated filenames are generally not meaningful. If you enable this setting (showfiles=1 in the properties file) you might want to reduce the number of thumbnails displayed across the page, as the filename will make each thumbnail cell wider. Note also the the `showfiles' setting is inherited by subdirectories, so you may need to re-disable it if you want visible filenames in one directory but not in its subdirectories. Thumbnails ========== photoindex creates thumbnail files whose names are the same as the original files, but preceded by `thumbnail_'. To avoid thumbnailing thumbnails produced by other programs, photoindex will not create a thumbnail for any file that has the string `thumbnail' in its file or directory name. The default size is 100x100 pixels, but the aspect ratio is kept constant. Also, to increase speed, the thumbnail will be the nearest size to that requested which is a submultiple of the original size. So, for example, if the original is 512x512, and we ask for a thumbnail 100x100, we will actuall get 128x128. Thumbnail sizes are set in the properties file, and can be different for each directory. Navigation up-links =================== With a hierarchical directory of images, it is nice to have up-links to higher-level directories to ease navigation. Of course one could always use the browser's `back' facility, but this is less convenient. History ======= V1.0, V1.1: never released V1.2 Apr 2001: first stable version V1.3 Feb 2002: enhancement release - removed necessity to specify URL root (because most browsers now process `..' in URLs - added facility to embedd pictures in HTML, to control size on screen Disclaimer ========== I have made this simple program available in the hope that it will be useful. Source code is included. Please do with it as you see fit, except claim it as your own work. There is absolutely no warranty.