Variables

The web pages jAlbum generates are based on "template pages" which can contain HTML and CSS code mixed with special tags, scripts and variables that are expanded to their values. When referring to a variable in HTML context, use the format ${variable}. In scripting context or when used in existence testing (see ja:if exists on the Tags page) simply use variable name as is.

Template file variables

The following variables are defined. Note that case is significant:

General
Name Explanation
albumDescription Description for the entire album. Picked from the root folder's description
albumHeight Album height in pixels. (Set when embedding album). Since v10
albumWidth Album width in pixels. (Set when embedding album). Since v10
albumURL Album address. Only available when processing "embed.htt". Since v10
albumTitle Title for the entire album. Taken from the root folder's name or Settings/General Album title
cols Number of image columns on index pages
currentRows Number of image rows on current index page
description Description for album directory
executedNormally Set to true after successful (not aborted or error) album generation. Can be referred to in finally.bsh
generator Name and version of jAlbum. It shows the major and minor version, for example jAlbum 13.10.
generatorUrl Address to the jAlbum homepage
homepageAddress Address (URL) to the album owner's home page (v10.8)
homepageLinkText Anchor text for home page link (v10.8)
imageNum Number of the current object, of any category, within an album
indexImageCount Number of objects, of any category, on current index page
indexNum The number of the current index page1
internalVersion Internal version number. It shows the full version number, for example jAlbum 13.10.3
language Define as user defined variable to explicitly set a language for a multilingual skin (ISO two character language code)
level Level of album directory (0 meaning root level)
maxImageWidth Max image width as set by user
maxImageHeight Max image height as set by user
maxThumbWidth Max thumbnail width as set by user
maxThumbHeight Max thumbnail height as set by user
pageType Values are 'index', 'slide', or 'page' (v10.4)
rows Max number of image rows on index pages
skin Name of current skin
style Name of current style sheet
totalIndexes Total number of index pages1
totalAlbumImages Total number of objects within the project, excluding folders, in an album (subdirectory images included)
totalImages Total number of objects, excluding folders, in a directory
textEncoding Character set and encoding of generated pages and comments



Navigation
Name Explanation
folder Only defined if curent file is a folder/directory. Use in ja:if exists tests (v6)
firstIndexPage Filename of the first index page
lastIndexPage Filename of the last index page
previousIndexPage Filename of the previous index page 2
nextIndexPage Filename of the next index page 2
parentIndexPage Filename of parent index page 2
closeupPath Path to get from index page to closeup image (or slide)
iconPath Path to icon for directories not having a thumbnail image and other non-image files
thumbPath Path to thumbnail image
rootPath Path to get back to the top of a multi directory level album
imagePath Path to the image that is shown in slides
originalPath Path to original file. Only defined if one of the following page settings is set:
Link to originals via scaled images is selected;
Link to hi-res via scaled images - it then points to the hi-res file;
Or
An original is included for a specific image;
A supported file type such as a video is included.

If linking is "Link to originals" then imagePath links to the original image

hiResPath Path to the hi-res file. Only defined if linking is "Link to hi-res via scaled images". Since 8.14
contentPath Same as imagePath for displayable images. Same as originalPath for other file types. Since 8.8
videoPath Path to get from the slide page to the converted MP4 video file, if video support is enabled. Since jAlbum 13

Note: For jAlbum 13 and later MP4 files go in the slides folder, for jAlbum 12 and earlier they are in the folder along with original images.

mediarssPath Path to the Media RSS version of this album (if any)
stylePath Path to the selected style file
styleFile Filename of the selected style file. Deprecated. Please use stylePath instead
resPath Path to the "res" directory containing album resources (support files like gif buttons etc)
firstPage Filename of the first slide page
lastPage Filename of the last slide page
previousPage Filename of the previous slide page 2
currentPage Filename of the current slide page
nextPage Filename of the next slide page 2
indexPage Filename of index page for current slide



File metadata
File metadata Meaning
label Folder name or the base name (without extension) of file
fileName Full name of image/movie or folder
title Alternative name for this file, folder or album title, or if not set, same as label
folderTitle Alternative name for this folder as entered in the GUI title field
fileTitle Alternative name for this file as entered in the GUI title field (v8.0)
fileCategory Category. Possible values are image, folder, video, audio, webPage, other of type Category (v11.0)
rating Rating. If rated, a number between 0 and 5 (v8.0)
includeOriginal Exists if user has checked current image to include original (v8.0)
thumbWidth Width of thumbnail image in pixels
thumbHeight Height of thumbnail image in pixels
imageWidth Width of image in pixels
imageHeight Height of image in pixels
originalWidth Width of original image in pixels
originalHeight Height of original image in pixels
originalWidthDpi Horizontal resolution of the original image
originalHeightDpi Vertical resolution of the original image
formatName Type of image
compressionLevel Level of compression as set by the camera
fileSize Size of original file
fileDate Date of original file
mimeType MIME type of original file (if defined in system/filetypes.xml)
originalDate Date written by camera 3
currentDate Date of album generation
digitizedDate Date an image was scanned. Since v13.3
resolution Original image resolution as written by camera 3
flash If flash was used 3
focalLength Focal length 3
focalLength35mm 35mm focal length equivalent 3. This variable is calculated with the focalLength as base, then multiplied with the focal length multiplier for that specific camera. Focal length multipliers can be edited in the system/cameras.properties file. If a multiplier isn't found for a particular camera, jAlbum tries to grab the 35mm focal length equivalent from the image itself (Nikon D90 writes this for instance). If this fails too, then this variable is undefined.
exposureTime Exposure time 3
isoEquivalent ISO equivalent 3
aperture Aperture 3
focusDistance Focus distance 3
meteringMode Metering mode 3
cameraMake Camera make 3
cameraModel Camera model 3
sensorType Camera sensor type 3
comment Comment. Will either be extracted from (as soon as found):
  1. An external "comments.properties" file.
  2. The JPEG comment section of an image file.
  3. The IPTC caption section of an image file. 3
  4. The EXIF user comment secion. 3
keywords IPTC keywords 3
category IPTC category 3
objectName IPTC Object name 3
headline IPTC Headline 3
photographer IPTC Photographer 3
writer IPTC writer 3
author Deprecated. use writer instead 3
copyright IPTC copyright 3
gpsLocation Google Maps formatted GPS location 3 (v11.2.5)
gpsLongitude GPS longitude in deg°min'sec.dec" format 3
gpsLatitude GPS latitude in deg°min'sec.dec" format 3
gpsAltitude GPS altitude (height) in meters 3
orientation Image orientation. Can be either "normal", "left" or "right"
videoFPS Frame rate of video 4 (v11)
videoDuration Length of video in hh:mm:ss.ff format 4 (v11)
videoClipLength Length of the edited clip. It's only present if the video has been edited. It's passed as a TimeCode object (v11)
clipLength Always present for videos and will contain either the clip length for edited or full length for unedited videos, in hh:mm:ss (no milliseconds) format (v13.4)
videoHeight Height of video in pixels 4 (v11)
videoWidth Width of video in pixels 4 (v11)
albumTags List of keywords for the album that can be entered in Settings/General. (v10.8)


Notes:

1 Not defined if only one index page exist

2 Only defined if such page exist

3 Only exists for (earlier than v14 jpg only) images containing EXIF/IPTC data and if EXIF extraction is turned on

4 Only defined for video files

You can list these variables and their current values by writing the following into a slide.htt template file:

<pre>${current}</ pre>

Implicit objects

Apart from having access to ordinary variables when scripting, jAlbum also provide some special objects (Java type within parenthesis):

Objects
Object name Explanation
out Page writer. Printing to out will generate output on the resulting page (PrintWriter)
application Container for variables bound to the current instance of jAlbum (Map)
album Container for variables bound to the current album generation (Map)
current Container for all variables bound to the current image (Map)
previous Container for all variables bound to the previous image (Map)
next Container for all variables bound to the next image (Map)
local Container for all variables bound to the local scope. Use to avoid inheritance (Map)
meta Container for all metadata variables (EXIF etc) found inside an image (Map)
programDirectory File object representing the current jAlbum directory (File)
skinDirectory File object representing the current skin directory (File)
skinResDirectory File object representing the res directory of the current skin (File)
imageDirectory File object representing the current image directory (File)
rootImageDirectory File object representing the root image directory (File)
outputDirectory File object representing the current output directory (File)
rootOutputDirectory File object representing the root output directory (File)
resDirectory File object representing the output resource directory (File)
files Array of File objects for the images and mediafiles in the current image directory (File[])
currentFile File object representing the currently processed file. A more convenient shorthand for files[imageNum-1] (File)
representingFile File object representing the original file that represents the current folder (or non-image file)
engine The album generating JavaBean inside jAlbum. See API (AlbumBean)
window The window of jAlbum, useful when creating modal popup windows like color pickers etc (Frame)
context Reference to the current JAlbumContext, which is a central repository for commonly used jAlbum classes. Since v8.6
currentObject Reference to the AlbumObject for the currently processed file. Since v9.4
currentFolder Reference to the AlbumObject for the currently processed directory. Since v9.4
rootFolder Reference to the AlbumObject for the root of the album. Since v9.4


Note: "current", "previous" and "next" are accessible for slide pages or within a ja:coliterator or ja:fileiterator on index pages.

The "meta" object usually contains more EXIF metadata than accessible from ordinary variables, but possibly in a more raw format. You may list all metadata found inside an image by putting the following code inside a slide.htt file:

<pre>${meta}</ pre>

The following example picks the "Owner Name" variable out of the meta object (assuming it exists, which it does for some Canon cameras):

${meta.Owner Name}


Understanding variables

Template file variables can be used anywhere where you can put text and html tags (HTML mode) and within <% scriptlets %> (BeanShell mode). In HTML mode, you have to use ${thisVariableFormat} to indicate is a variable, in BeanShell mode, just refer to the variable by its name.

Constant variable notation

Before any BeanShell scripts are processed for a certain page, jAlbum replaces any occurrence of $variablesInThisFormat with their current values. This notation therefore works for referring to variables that aren't introduced or modified by a script. The replacement is a simple search & replace operation, so you can even use this syntax in a script. The only thing the script will see is the replaced value. Use with caution as errors are usually harder to debug when using this format.

User defined variables

jAlbum users can define new variables using the "User defined variables" table in the advanced section. These variables behave like other skin template variables and can also override existing variables. You can use user defined variables to add even more flexibility to the look of the skins you create. Usually, user defined variables become variables of String type no matter what value they have (for backward compatibility). This isn't very convenient if you wish to work a lot with boolean or integer variables (requires type conversion). Automatic type conversion to boolean, integer and double is however performed if jAlbum senses that the particular skin has a custom user interface.

The type conversion is performed like this:

  • Numeric string with decimals -> double
  • Numeric string -> integer
  • The string true or false -> boolean
  • Any other string -> no conversion