| static-picture-publish - create a web dir structure from an image dir. |
static-picture-publish - create a web dir structure from an image dir.
static-picture-publish --help
static-picture-publish --version
static-picture-publish [options] picRoot webRoot
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.
Print a help message, describing the program options.
Print the program version and exit.
Run silently, without printing any normal output.
Print more information about actions.
(Unimplemented) Copy the originals instead of symlinking them.
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.
(Unimplemented) Don't symlink or copy originals.
Set maximum dimension for images. (Default 640x640 pixels)
Set maximum dimension for thumbnails. (Default 128x128 pixels)
Force regeneration of HTML or XML output.
Don't create HTML from XML. (Unimplemented)
Force regeneration of all output.
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.
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.
CSS file to use in HTML or XML output. (Default inbuilt.) The CSS file will be copied into webRoot and renamed to spp.css.
Number of images per row in HTML. (Default 3.)
XSLT file to use for directory XML output. (Default inbuilt.) The file will be copied into webRoot and renamed to spp-dir.xsl.
XSLT file to use for image XML output. (Default inbuilt.) The file will be copied into webRoot and renamed to spp-image.xsl.
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.
To generate HTML, use the xsltproc program instead of the python XML libraries.
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.
The format of the file is like the INI format. (Also see the section ``Example config file'', below.) It can contain these sections:
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.
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.
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.
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.
This section is handled in the same way as the [folder order] section
above, but for images.
(Unimplemented) This section contains a list of original name = output
name pairs. All other references to the name are to the output name.
The way that the [include] and [exclude] sections are handled is
slightly strange.
Firstly, if there is no config file in this directory, or there is a config
file but it has no [include] or [exclude] sections, then all images and
folders are included.
If there is an [include] section, the default action is to not include
an image or folder.
If the image or folder is mentioned in the [include] section, it is only
included if the value of the include key is True. As above, this will be
the case if there is no include key at all.
If the image or folder is mentioned in the exclude section, it is only
included if the value of the exclude key is False. This will not
normally be the case, unless the exclude key is mentioned explicitly.
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.
(Unimplemented) Specify the name to use for this entry in the output. All references to the image or folder will use NAME.
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.
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.
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
Some, probably...
Russell Steicke <russells@adelie.cx>
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.
0.1
| static-picture-publish - create a web dir structure from an image dir. |