A template defines what and how the output is generated by this program. In other programs this feature is called layout or skin. Here a template is a directory under the "templates" directory. It contains the following files:
The simplest way to create a new template is to copy the whole directory under a new name.
After that, edit the template.cfg, the template files or graphics.
PyAlbum uses Empy as underlying driver for its templates. Empy is a very powerful and robust templating system for Python.
You can use @variables, @obj.attributes, @(functions) @(conditionals?...!...),
@[if statements], @[for loops], @{statements} and much more here!
For a full documentation of Empy take a look at its
home page.
If you do not want to dive very deep, simply look at the template files in template 'testall'. But pay attention to the different meanings of @(), @[] and @{}!
You also need some very basic knowledge of Python.
The most important thing to know here is, that an @[if xx] yields False, if xx is an
empty string or an empty list or a "None" object.
To be continued...
Dictionary for a OnceFile: | |
gal | An object of class EmpyGallery |
tag | The tag for this OnceFile |
user.xx; | All options beginning with user. and declared by option xUserOpts |
Dictionary for an IndexFile: | |
gal | An object of class EmpyGallery |
part | An object of class EmpyPart |
tag | The tag for this OnceFile |
user.xx; | All options beginning with user. and declared by option xUserOpts |
Dictionary for a PictureFile: | |
gal | An object of class EmpyGallery |
pic | An object of class EmpyPicture |
tag | The tag for this OnceFile |
user.xx; | All options beginning with user. and declared by option xUserOpts |
Class EmpyGallery ("gal" object in all output files) | |
gal.charset |
Defined by option CharSet, eg: "ISO-8859-1" or "UTF-8" Default: "ISO-8859-1" |
gal.created |
Modification time of gallery (last run), formatted according to options DateFormat and TimeFormat. Usable as "Last updated: @gal.created" |
gal.description[text] |
List (array, vector) of texts. The content is collected from several sources according to option folderDescriptionMethod Example usage: @[for desc in gal.description]@ @desc <br/> @[end for]@ |
gal.dirs[EmpyDirectory] |
Ordered list (array, vector) of all valid subgalleries. Valid means: contains usable pictures.
Example usage:
@[for dir in gal.dirs]@ <...handle @dir attributes...> @[end for]@ |
gal.generator | Name of this program with version. |
gal.indexFooterInc |
If file "indexfooter.inc" exists in the picture input directory, this attribute is set to the full path of this file, otherwise it is an empty string. There are six of these attributes to include user definable texts or HTML code inside the templates: [once|index|picture][Header|Footer]Inc. Use it inside template files like this: @[if gal.indexFooterInc]@ @{empy.include(gal.indexFooterInc)} @[end if]@ |
gal.indexHeaderInc |
If file "indexheader.inc" exists in the picture input directory, this
attribute is set to the full path of this file, otherwise it is an empty
string. See gal.indexFooterInc |
gal.indexParts | Number of index parts for this gallery. Depends on options MaxRows and PicsPerRow and on the number of pictures within that directory calculated in PanoramaWidth. |
gal.lastmodified | Generation time of the output files as GMT. "Wed, 07 Jan 2004 18:43:13 GMT" This is a format for HTML headers. |
gal.level | Starting from 0 in the first input directory this number is increased for each hierarchy depth. |
gal.maxLowresHeight | Height option set for lowres pictures (Option LowresHeight). |
gal.maxLowresWidth | Width option set for lowres pictures (Option LowresWidth). |
gal.maxThumbHeight | Height option set for thumbnail pictures (Option ThumbMaxHeight). |
gal.maxThumbWidth | Width option set for thumbnail pictures (Option ThumbMaxWidth). |
gal.number | Number from 0, all subdirectories are sorted and numbered |
gal.numDirs | Number of sub galleries in this gallery |
gal.numPics | Number of pictures in this gallery. |
gal.onceFooterInc |
If file "oncefooter.inc" exists in the picture input directory, this
attribute is set to the full path of this file, otherwise it is an empty
string. See gal.indexFooterInc |
gal.onceHeaderInc |
If file "onceheader.inc" exists in the picture input directory, this
attribute is set to the full path of this file, otherwise it is an empty
string. See gal.indexFooterInc |
gal.outBaseName | The name of the output base directory. It is "cleaned" from special characters and made unique among its siblings. |
gal.parentHref | A link to the parent directory index file. |
gal.parts[EmpyPart] |
Ordered list (array, vector) of all index pages with the same tag.
Example usage:
@[for actpart in gal.parts]@ <...handle @actpart attributes like hmtlHref...> @[end for]@ |
gal.pathList[(url, name)] |
Special Python list for generating links to the start page from all levels. The following example shows the hierarchy
from within an index template file. The last element has no href, since that would point
to itself.
@[for (href,name) in gal.pathlist[:-1]]@ <a href="@href">@name</a> :: @[end for]@ @gal.pathlist[-1][1] |
gal.pics[EmpyPicture] | List of all pictures in this gallery. If you do not want to iterate over rows and columns from the "part" object, you can iterate over this list. |
gal.pictureFooterInc |
If file "picturefooter.inc" exists in the picture input directory, this
attribute is set to the full path of this file, otherwise it is an empty
string. See gal.indexFooterInc |
gal.pictureHeaderInc |
If file "pictureheader.inc" exists in the picture input directory, this
attribute is set to the full path of this file, otherwise it is an empty
string. See gal.indexFooterInc |
gal.progURL | Home page of this program ("http://xxx") |
gal.resHref |
A link to the resource directory (option resDir).
This is without a trailing "/"! Usage example:
@gal.resHref/leftarrow.gif |
gal.templateName | Name of the used template. Same value as option TemplateName. |
gal.thumbHeight | Height of the thumbnail/icon for this gallery. For the highest level gallery there is no thumbnail generated, its height is set to "10". |
gal.thumbHref | Link to the the thumbnail/icon for this gallery ("" for top gallery). Only useful for a parentGal object. Usage example see dir.thumbHref |
gal.thumbWidth | Width of the thumbnail/icon for this gallery. For the highest level gallery there is no thumbnail generated, its width is set to "10". |
gal.title | Title of this gallery. Defined by option folderTitleMethod. |
gal.totalNumDirs | Total number of sub galleries, recursive. |
gal.totalNumPics | Total number of pictures, recursive |
Class EmpyDirectory (Element of gal.dirs[], short version of EmpyGallery) | |
dir.description[text] | List (array, vector) of texts. The content is collected from several sources according to option folderDescriptionMethod. |
dir.htmlHref | Link to the first index page of that directory/gallery. That is defined by the first option IndexFile. |
dir.level | Number of recursion depth in the gallery tree. Root is 0. |
dir.number | Number from 0, all subdirectories are sorted and numbered |
dir.numDirs | Number of sub galleries |
dir.numPics | Number of pictures |
dir.outBaseName | The name of the output base directory. It is cleaned from all special characters and made unique among its siblings. |
dir.thumbHeight | Height of thumbnail picture for this directory. |
dir.thumbHref | Path to thumbnail picture or "", if no thumbnail was generated (option ThumbGallery). |
dir.thumbWidth | Width of thumbnail picture for this directory. |
dir.title | Short title of this gallery. Defined by option folderTitleMethod |
dir.totalNumDirs | Total number of sub galleries, recursive. |
dir.totalNumPics | Total number of pictures, recursive |
Class EmpyPart ("part" object in all index files) | |
An EmpyPart is a synonym for "index page". It contains rows of pictures and has some attributes. If there are more pictures in a gallery than do fit in option PicsPerRow and MaxRows, more than one index pages will be created. You can navigate through them with first, next, prev and last. It is a list of rows, which are lists of EmpyPicture. If a picture is too wide to fit in an already occupied row (panoramaWidth > 1), the open row is filled with "None" and the picture starts a new row. So we have kind of "holes" in the sequence! If there is only one row on an index page, trailing "None"s are removed, so the generated table looks nicer. The correct coding in template files is: <table> @[for row in part]@ <tr> @[for pic in row]@ @[if pic]@ <td colspan="@pic.panoramaWidth"> <...use @pic...> @[else]@ <td> @[end if]@ </td> @[end for]@ </tr> @[end for]@ </table> |
|
part.first | First EmpyPart object (index page) or None if there is only 1 index page. |
part.htmlHref | The href to the index file of the part. If you code @part.next.htmlHref, is will link to the next index file with the same tag as the actual index file (e.g. lowres to lowres). |
part.last | Last EmpyPart object (index page) or None if there is only 1 index page. |
part.next | Next EmpyPart object (index page) or None if this is the last index page. |
part.numParts | Number of all parts (all index pages). |
part.numPics | Number of pictures on this index page. |
part.numRows | Number of table rows on this index page. The maximum is set with option MaxRows. |
part.partNo | Number of this part among all parts, starting from 0 |
part.picsPerRow | Number of pictures per row (=number of table columns). |
part.prev | Previous EmpyPart object (index page) or None if this is the first index page |
part.sibling_once_xx | The href to the OnceFile with tag "xx". This is the way to get your style sheet or frame set. |
part.sibling_index_xx | The href to IndexFile with tag "xx". If used from within an IndexFile (and this is the case here, because "part" is only defined in index files!), it points to the same partNo, otherwise to the first index file with tag xx. This is usable to switch between lowres and full index. |
part.sibling_picture_xx | The href to the first PictureFile with tag "xx". |
Class EmpyPicture ("pic" object in all picture files, gal.pics[], part[][]) | |
|
|
pic.colNo | Column number inside table (counts from 0) |
pic.description[text] | List of texts. Defined by option picDescriptionMethod. |
pic.fileTime | The modification date/time of the original picture. Use if exif.DateTimeOriginal is empty. Formatted according to options "DateFormat TimeFormat". |
pic.formatName | The file format of the original picture. JPEG, TIF, ... |
pic.fullBaseName | File name of the "full" picture without extension. |
pic.fullExt | Extension with leading dot. E.g. ".JPG" |
pic.fullFileName | File name of the "full" picture with extension. |
pic.fullFileSize | Size of the "full" picture with "KB" or "MB" appended. |
pic.fullHeight | Height of the "full" picture in pixels. |
pic.fullHref | Href to the "full" picture,e.g. "../fullpics/pic1.jpg" |
pic.fullWidth | Width of the "full" picture in pixels. |
pic.htmlHref | Href to the html file displaying that picture, e.g. "html/pic1.html" |
pic.lowresBaseName pic.lowresExt pic.lowresFileName pic.lowresFileSize pic.lowresHeight pic.lowresHref pic.lowresWidth |
These have all the same meaning as pic.fullXX, but for the low resolution picture. |
pic.movieBaseName | File name of an associated movie file without extension. |
pic.movieExt | File extension of an associated movie file, e. g. ".avi". |
pic.movieFileName | File name of an associated movie file, with extension. |
pic.movieFileSize | Size of an associated movie file with "KB" or "MB" appended. |
pic.movieHref | Href to an associated movie file displaying that movie, e.g. "full/test.avi" |
pic.number | Number from 0, all pictures within a directory are sorted and numbered. |
pic.outBaseName | File name of the output picture without extension. Later on this name is converted by Options FullOutName, LowresOutName and ThumbOutName to pic.fullBaseName, pic.lowresBaseName and pic.thumbBaseName, but this value is always the same and always available. |
pic.panoramaWidth | Normally 1. For wide panorama pictures this can be a number up to option "picsPerRow". Use this value for colspan in html. |
pic.parentHref | Href to the first index page of this gallery. If there exists an IndexFile with the same tag as the actual PictureFile, the link goes to that index file, otherwise to that with the first tag. The parent of the topmost album is definable by option RootParent. |
pic.rowNo | The row number inside the index table (counts from 0) |
pic.soundBaseName | File name of an associated sound file without extension. |
pic.soundExt | File extension of an associated sound file, e. g. ".avi". |
pic.soundFileName | File name of an associated sound file, with extension. |
pic.soundFileSize | Size of an associated sound file with "KB" or "MB" appended. |
pic.soundHref | Href to an associated sound file playing that sound, e.g. "full/test.avi" |
pic.thumbBaseName pic.thumbExt pic.thumbFileName pic.thumbFileSize pic.thumbHeight pic.thumbHref pic.thumbWidth |
These have all the same meaning as pic.fullXX, but for the thumbnail (icon). |
pic.title | Short title of this picture. Defined by option picTitleMethod |
EXIF data ("pic.exif" object) | |
Each EmpyPicture has an according exif object, even if there is no
EXIF data in the file. You may test for existence of Exif data by testing exif.Make, which should be always filled by a camera. Two special comment fields lay outside of the Exif section and are handled HERE inside the pic.exif environment: These are "Comment" (called "JPEG comment" by some programs. This is the COM segment within the JPEG/TIFF specification) and "UCComment" (UNICODE comment, stored in JPEG segment "APP 10" by a program named PhotoStudio). Beware: UNICODE is not completely handled by this program! But Latin-1 characters are safe here. Beware: some text fields from Exif are converted to HTML, some are NOT, some exist in both versions.
|
|
pic.exif.ApertureValue | The lens aperture. The unit is the APEX value. |
pic.exif.Artist |
EXIF field settable with some Exif programs or cameras. Converted to HTML. |
pic.exif.BrightnessValue | The value of brightness. The unit is the APEX value. Ordinarily it is given in the range of -99.99 to 99.99. Note that if the numerator of the recorded value is FFFFFFFF.H, Unknown shall be indicated. |
pic.exif.Comment |
JPEG comment in picture file. It is not a real part of the EXIF data, so it may exist
even if there is no real EXIF data in the file. It exists in JPEG segment COM. This is converted to HTML. |
pic.exif.COM | Same as pic.exif.Comment, but NOT converted to HTML. |
pic.exif.Copyright |
This is a 2 value field consisting of photographer copyright ("PC:") and editor copyright ("EC:"). Converted to HTML. |
pic.exif.DateTime | Date and time the EXIF data was last modified. Converted according to options DateFormat and TimeFormat. |
pic.exif.DateTimeDigitized | Date and time converted according to options DateFormat and TimeFormat |
pic.exif.DateTimeOriginal | Date and time converted according to options DateFormat and TimeFormat |
pic.exif.exiflist |
This is a special object containing all read EXIF attributes and their
values. It contains a sorted list of (name, value) pairs. The names differ
slightly from all other EXIF names you find on this page, because they
have a prefix like "EXIF" or "Image" or "MakerNote". The values are converted to HTML if necessary. Values longer than 100 characters are filtered out, so there is not so much garbage (like from MakerNote) in the output. Usage example: @[if pic.exif.Make]@ <table width="100%" border="1"> @[for (exifname, exifval) in pic.exiflist]@ @[if exifval]@ <tr> <td>@exifname:</td> <td>@exifval</td> </tr> @[end if]@ @[end for]@ </table> @[end if]@ |
pic.exif.ExifVersion | Version used, written by camera. |
pic.exif.ExposureBiasValue | The exposure bias. The unit is the APEX value. Ordinarily it is given in the range of -99.99 to 99.99. |
pic.exif.ExposureIndex | Indicates the exposure index selected on the camera or input device at the time the image is captured. |
pic.exif.ExposureProgram | The class of the program used by the camera to set exposure when the picture is taken. The tag value is translated to english text according to EXIF specification, e.g. "Manual", "Normal program", "Shutter priority", ... |
pic.exif.ExposureTime |
Exposure time in seconds (e.g. "1/125") If this field is empty in EXIF and the ShutterSpeedValue is set, the value is copied from ShutterSpeedValue (Fuji MX600-Zoom leaves this value empty). |
pic.exif.Flash | For now it just returns "flash" or "" (this will be extended in the next version!) |
pic.exif.FlashEnergy | Indicates the strobe energy at the time the image is captured, as measured in Beam Candle Power Seconds (BCPS). |
pic.exif.FNumber |
The F number. Total exposure is determined by F number, shutter speed and ISO
rating. If this field is not filled by the camera (some Ricoh cameras), the value of this field is calculated from ApertureValue (2 ** (ApertureValue/2)). |
pic.exif.FocalLength | The real focal length used by the camera |
pic.exif.FocalLengthConv |
Focal length converted to 35mm cameras If the EXIF data contains a tag "FocalLengthIn35mmFilm", the value from that tag is used, otherwise the value from tag "FocalLength" is used for calculation with factors from file "FocalFactors.txt" inside the program directory. There has to be a factor for each Make and Model. See also option DefaultFocalFactor. |
pic.exif.ImageDescription |
This is settable with some programs. Converted to HTML. |
pic.exif.ImgDesc | Same as pic.exif.ImageDescription, but NOT converted to HTML. |
pic.exif.ISOSpeedRatings | e.g. "100" |
pic.exif.LightSource | An english text given in the EXIF specification. E.g. "unknown", "Daylight", ... |
pic.exif.Make | Maker of the camera. E.g. "FUJIFILM", "Canon", ... |
pic.exif.MakerNote | !!! This is a binary field depending on the camera! Not useful yet! Will be expanded in future versions of this program. |
pic.exif.MaxApertureValue | The smallest F number of the lens. The unit is the APEX value. |
pic.exif.MeteringMode | Enhglish text: "Average", "Spot", "Multispot", "Pattern", ... |
pic.exif.Model | The camera model. E.g. "MX-600ZOOM", "Canon Powershot A70", ... |
pic.exif.Orientation | The image orientation viewed in terms of rows and columns. A number from 1 to 8. |
pic.exif.ResolutionUnit | The unit for XResolution and YResolution, most time "inch" |
pic.exif.SensingMethod | English text according to EXIF specification. E.g. "Two-chip color area sensor", ... |
pic.exif.ShutterSpeedValue |
= - log2 (exposure time) This value is calculated to an exposure time, e. g. "1/123". Some cameras only write one of both values. PyAlbum fills the ExposureTime with this value, if ExposureTime is empty. |
pic.exif.Software |
Camera software with version. Converted to HTML. |
pic.exif.SpectralSensitivity | Indicates the spectral sensitivity of each channel of the camera used. The tag value is an ASCII string compatible with the standard developed by the ASTM Technical committee. |
pic.exif.SubjectDistance | The distance to the subject, given in meters. |
pic.exif.UCComment |
UNICODE comment, laying outside of EXIF data like exif.Comment. We support only Latin-1 here! This is converted to HTML. A program named PhotoStudio writes this comment to JPEG segment App 10. |
pic.exif.UCCOM |
Same as UCComment. NOT converted to HTML. |
pic.exif.UserComment |
Settable with some Exif programs or cameras. This is converted to HTML. |
pic.exif.UserCom |
Same as UserComment. NOT converted to HTML. |
pic.exif.XResolution | Dots per < ResolutionUnit > (most time "inch". E.g. "180/1", "72/1") |
pic.exif.YResolution | Dots per < ResolutionUnit > (most time "inch". E.g. "180/1", "72/1") |