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. You can separate several variables using the pipe character. jAlbum will then pick the first non-empty one, for instance:

${comment|fileName}

You can also add a plain string default value, for instance:

Aperture: ${aperture|"Not available"}

Developers, to see what version of jAlbum variables/features were introduced use the 'History' tab at the top of the page to view the revision as of 30 June 2018 13:08.

Videos have a set of variables used by ffmpeg when transcoding, the variables can be used in the ‘custom settings’ section of the video settings pane, and as such they can be found in that settings help page.

Other information on objects and settings can be obtained through the Java API such as Counting the number of object types in a folder

Template file variables

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

General

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).
albumWidth Album width in pixels. (Set when embedding album).
albumURL Album address. Only available when processing "embed.htt".
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 16.1
generatorUrl Link to the jAlbum homepage, in the language used to build the album.
homepageAddress Address (URL) to the album owner's home page
homepageLinkText Anchor text for home page link
imageNum Number of the current object, of any category, within an iterator
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 16.0
language The two-character ISO code corresponding to the user's language preference 9
level Level of album directory (0 meaning root level)
maxFolderThumbWidth Max folder image width as set by user10
maxFolderThumbHeight Max folder image height as set by user10
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'
rows Max number of image rows on index pages
skin Name of current skin
skinName Name of current skin
skinVersion Version 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

Navigation
Name Explanation
folder Only defined if current file is a folder/directory. Use in ja:if exists tests
firstIndexPage Filename of the first index page
lastIndexPage Filename of the last index page
previousIndexPage Filename of the previous index page 2, 6
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) or web location.
targetURL Path to the target Url of a web location object 2
iconPath Path to icon for directories not having a thumbnail image and other non-image files
thumbPath Path to thumbnail image
thumbSrcset Path to the base and variant(s) thumbnail image 8
rootPath Path to get back to the top of a multi directory level album
imagePath Path to the image that is shown in slides
imageSrcset Path to the base and variant(s) image that is shown in slides 8
originalPath Path to the original file. Only defined if one of the following is true:
Originals are included in the image settings;
A specific image has "Include original" selected;
A specific image has "Use original" selected;
The album object is a supported file type such as a video or PDF.

If only originals are included, and not scaled images, imagePath links to the original image

contentPath Same as imagePath for displayable images. Same as originalPath for other file types.
videoPath Path to get from the slide page to the converted MP4 video file, if video support is enabled.
audioClipPath Path to get to an attached audio clip file, void if no clip attached
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 Path to the previous slide page 2
currentPage Filename of the current slide page
nextPage Path to the next slide page 2
indexPage Filename of index page for current slide
themePath Path to the current folder’s theme image 5
themeWidth Width of the current folder’s theme image 5
themeHeight Height of the current folder’s theme image 5

File metadata

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 (also for folders on index pages)
fileCategory Category. Possible values are audio, folder, image, other, video, webLocation and webPage of type Category
rating Rating. If rated, a number between 0 and 5
includeOriginal Exists if user has checked current image to include original
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 6
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,7
currentDate Date of album generation
digitizedDate Date an image was scanned.
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
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"
audioClipType Path to get to an attached audio clip file. void if no clip attached
audioClipDuration Length of an audio clip in hours:minutes:seconds.decimal seconds, only exists if an object has an attached clip.
videoFPS Frame rate of video 4
videoDuration Length of video in hh:mm:ss.ff format 4
videoClipLength Length of the edited clip. It's only present if the video has been edited. It's passed as a TimeCode object
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
videoHeight Height of video in pixels 4
videoWidth Width of video in pixels 4
albumTags List of keywords for the album that can be entered in Settings/General.
projectionType For photo sphere (360/180 degree) images returns equirectangular, for other objects returns null.

Notes:

1 Not defined if only one index page exist

2 Only defined if such page exist

3 Only exists for images containing EXIF/IPTC data and if EXIF extraction is turned on. For mp4 videos with gps in xmp, not Quicktime directories.

For v14.1.13+ location data is as set in the 'location' window, if no location has been set and GPS data is embedded by the camera it is the 'as taken' location. If both tagged and embedded location information exists the 'as taken' values can be obtained via meta.get("Gps.GPS Latitude") and meta.get("Gps.GPS Longitude")

4 Only defined for video files

5 Only if folderImageSize is defined and Theme Images method 1 is used

6 Returns JPEG, GIF, or png. For video files, returns JPEG. For other non-image files (PDF's, for example), returns png.

7 Videos, originalDate only exists for MP4 and QuickTime formats

8 From jAlbum 24, empty string if not supported by the skin in use (skin properties > supportsVariants=true)

9 Defined in jAlbum 25.1 and above and if supported by the skin - void in earlier versions

10 Defined in jAlbum 26.3 and above and if supported by the skin - void in earlier versions

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

<pre><% out.print(current.flatten().toString()); %>< /pre>

Or call current.getMap().toString(), to get the keys and values of the innermost scope only

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) 6
next Container for all variables bound to the next image (Map) 6
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.
currentObject Reference to the AlbumObject for the currently processed file.
currentFolder Reference to the AlbumObject for the currently processed directory.
rootFolder Reference to the AlbumObject for the root of the album.

6 Only defined for sibling folders e.g. not available for chained directories outside current directory.

Note: "current", "previous" and "next" are accessible for slide pages and "current" 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, without a ‘.’ In its name, 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


Other variables

There are variables that hold the status of the various settings of both jAlbum and the skin being used. If you want to use these variables as controls for your html/css template pages (.htt) then one way of discovering them is to open the '.jap' settings file jAlbum makes when you save your project. Open the file in a text editor and look at the text before the '=' sign.

For example, if you want to know if high dpi thumbnails or slide images has been selected search for 'dpi' and you will find:

hiDPIThumbs=false
hiDPIImages=true

So, the variables associated with those settings are hiDPIThumbs and hiDPISlides. You can get the value in scripts using engine.isHiDPIImages()


You can also open a terminal window and type

java -jar JAlbum.jar -?

to list all switches, they have the same name as the controls of the window


Skin variables are all identified by the fact they are prefixed with 'skin.', such as:

skin.fullscreen=false


Most variable names will either be as expected or include a string you would expect, such as the image setting for embedding a copyright URL is 'rightsURL'. If you can't find the variable you are looking for try the API or simply toggle the setting you are interested and see what variable has changed value in the settings file.