static-picture-publish - create a web dir structure from an image dir.


NAME

static-picture-publish - create a web dir structure from an image dir.


SYNOPSIS

static-picture-publish --help

static-picture-publish --version

static-picture-publish [options] picRoot webRoot


DESCRIPTION

Create a web directory structure from an image directory structure. picRoot is the root of the image directory, and webRoot is the root of the web directory. Subdirectories of picroot will be duplicated in webRoot, containing thumbnails and smaller versions of images in picRoot, along with XML and HTML web pages to enable viewing them.

static-picture-publish produces XML output initially, then processes that with xsltproc to produce HTML. (This is only necessary because Internet Explorer 6, while it can process XML and XSLT, does strange things when given a relative path to the XSL stylesheet. Firefox and Mozilla Seamonkey can view the XML files well.)

If you start viewing the XML files (eg by opening index.xml in the web root directory with a web browser), then all the links will take you to XML files, which need to be processed correctly by your web browser. If you start viewing HTML files (by opening index.html, perhaps implicitly as a DirectoryIndex file served by apache), then all the links will take you to HTML files.


OPTIONS

General options

--help

Print a help message, describing the program options.

--version

Print the program version and exit.

-q
--quiet

Run silently, without printing any normal output.

-v
--verbose

Print more information about actions.

Image options

-c
--copy

(Unimplemented) Copy the originals instead of symlinking them.

-eEXTENSIONS
--extensions=EXTENSIONS

Specify a comma-separated list of file extensions to process. These files must be recognised by the Python Imaging Library. The extensions are compared case-folded. The default list is .jpg,.jpeg,.gif,.png. If specified, the list is replaced, not extended.

-n
--no-originals

(Unimplemented) Don't symlink or copy originals.

-sIMAGE_SIZE
--image-size=IMAGE_SIZE

Set maximum dimension for images. (Default 640x640 pixels)

-zTHUMBNAIL_SIZE
--thumbnail-size=THUMBNAIL_SIZE

Set maximum dimension for thumbnails. (Default 128x128 pixels)

Markup options

-g
--regen-markup

Force regeneration of HTML or XML output.

-N
--no-html

Don't create HTML from XML. (Unimplemented)

-r
--regen-all

Force regeneration of all output.

-S
--subdir

Run as if in a subdirectory of the output directory. This is used to (re-)generate only a part of the output tree, so you don't have to process the whole thing again if you've just changed on part. This option requires the stylesheet files (spp.css, spp-dir.xsl and spp-image.xsl) to already be in place. They won't be copied in, and it's an error if they can't be found by searching up the output directory tree.

This option also forces the creation of an ``Up'' link in the top-most processed folder, which is not normally created.

-tTITLE
--title=TITLE

Set the HTML title. This will appear on all pages as ``Title - name'', where Title is what you set here, and name is the name of the folder or image you are viewing.

Layout options

--css=CSS

CSS file to use in HTML or XML output. (Default inbuilt.) The CSS file will be copied into webRoot and renamed to spp.css.

--row=ROW

Number of images per row in HTML. (Default 3.)

--xsl-dir=XSL_DIR

XSLT file to use for directory XML output. (Default inbuilt.) The file will be copied into webRoot and renamed to spp-dir.xsl.

--xsl-image=XSL_IMAGE

XSLT file to use for image XML output. (Default inbuilt.) The file will be copied into webRoot and renamed to spp-image.xsl.

Other options

--delete

Delete unused files and directories in the output. Files that have been generated by static-picture-publish (on this run or on previous runs) will be kept, as well as any file called .htaccess.

Using this options, you can rearrange your picture directories, and the web copies will be kept up to date automatically after you run .static-picture-publish again, without accumulating old copies of pictures and directories.

--xsltproc

To generate HTML, use the xsltproc program instead of the python XML libraries.


PER-DIRECTORY CONFIG FILE

If static-picture-publish finds a .static-picture-publish or .static-picture-publish.txt file in the picRoot or a subdirectory of that, it is taken as a configuration file to specify how the contents of that directory are to be processed. Both files can exist, and both will be read if they exist.

Format

The format of the file is like the INI format. (Also see the section ``Example config file'', below.) It can contain these sections:

[folder]

The [folder] section can contain one key, [thumbnail], which is the name of an image in the directory. The thumbnail of that image will be used as the icon for that directory in its parent directory. It this secion of key is missing, a random image from the directory will be used as the thumbnail.

[include]

If the [include] section exists, only files and directories that are mentioned in here will be included in the output. The value of the entry is a space separated list of key=value items. The possible keys are explained below.

A key without a value results in that key having a value of True.

If there exists a key with no value, and the key is one of 1, on, true or yes (boolean true, without regard to case), that results in the key include having the value True.

If there exists a key with no value, and the key is one of 0, off, false or no (boolean false, without regard to case), that results in the key include having the value False.

If there is no include key, or no key with a boolean name and no value, then it is as if the section had a key-value pair of include=True.

The [include] section can contain one special key: *. The value of this key is a boolean that specifies the default include value for entries. The rationale for this is that if you wish to rotate just one entry, that is done in the [include] section, and having that section makes the default rule to exclude anything not mentioned there, so you'd then have to mention every file in the [include] section. Instead, you can change the default with a * key.

[exclude]

If the [exclude] section exists, files and directories mentioned in there can be excluded. Like above, the value is a space separated list of key=value items. Keys without values are handled as for the [include] section, except that the key that is affected by default is exclude.

[folder order]

Keys in this section are folder names, and each value is the position in the output folder list for that folder. The list is not checked to see that the indexes are within the number of folders available, which means that if you miscalculate the folder numbers the program may abort. The way this list is used is that first the list of folders is sorted into lexical order (locale-dependent), then each folder mentioned in [folder order] is put in the output list in that position, then the remaining folders are put in the output list by ``filling in the gaps'' in order.

[image order]

This section is handled in the same way as the [folder order] section above, but for images.

[names]

(Unimplemented) This section contains a list of original name = output name pairs. All other references to the name are to the output name.

[include] and [exclude] processing

The way that the [include] and [exclude] sections are handled is slightly strange.

key-value pairs

rotate=X

Rotate the output images (thumbnail and web-sized version) by X degrees counterclockwise. The original is not affected by this value, and is presented un-rotated.

X can only be the values 90, 180, 270, -90, left, upsidedown or right.

Note that static-picture-publish will read EXIF data from the images, so if your image was taken with a digital camera it will be rotated correctly without you having to specify this value.

name=NAME

(Unimplemented) Specify the name to use for this entry in the output. All references to the image or folder will use NAME.

Example config files

The common reason to include a config file is to exclude just a couple of images:

 [include]
 * : True
 Embarrassing_pic_1.jpg  : False
 And_this_one.jpg        : False

A longer example:

 [include]
 a.jpg : include=1
 b.jpg : rotate=90
 c.jpg : rotate=-90 false
 d.jpg : True
 *     : True
 [exclude]
 d.jpg : True
 [folder order]
 Things  : 1
 Stuff   : 2

With this config file, a.jpg and b.jpg will be included, but c.jpg and d.jpg will not. In addition, b.jpg will be rotated by 90 degrees counter-clockwise.

Any image or folder not mentioned in the [include] or [exclude] sections will be included because of the ``* : True'' entry in the [include] section.

The folder Things will be included in the output before the folder Stuff, even though they would normally sort by name in the opposite order.


IMAGE COMMENTS

static-picture-publish will use image comments that are saved by gthumb. These are stored in files named like .comment/a.jpg.xml for example for an image called a.jpg. The ``Notes'' text from this file will be used as a comment for the image in both the directory and image views. It will be truncated to 75 characters in directory view and 295 characters in image view.

Comments saved by other programs (gqview and nautilus in particular) will be added when I get to it.

Storage of this information should really be a freedesktop.org standard.


EXAMPLES

Publish pictures from /home/joe/pics to /var/www/pics, specifying the thumbnail size.

 static-picture-publish -z 100x100 /home/joe/pics /var/www/pics


BUGS

Some, probably...


AUTHOR

Russell Steicke <russells@adelie.cx>


COPYRIGHT

Copyright (C) 2008 Russell Steicke. Released under the terms of the GNU General Public License, but dedicated to the public domain at the beginning of the tenth calendar year after publishing (ie the start of 2018 for version 0.1, released in 2008).

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


VERSION

0.1

 static-picture-publish - create a web dir structure from an image dir.