Developer Center

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. Picked from the root folder's title
    cols
    Number of image columns on index pages
    currentRows
    Number of image rows on current index page
    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
    generatorUrl
    Address to the jAlbum homepage
    imageNum
    Number of the current image within an album
    indexImageCount
    Number of images on current index page
    indexNum
    The number of the current index page 1
    internalVersion
    Internal version number
    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
    rows
    Max number of image rows on index pages
    skin
    Name of current skin
    style
    Name of current style sheet
    description
    Description for album directory
    totalIndexes
    Total number of index pages 1
    totalAlbumImages
    Total number of images in an album (subdirectory images included)
    totalImages
    Total number of images 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 linking is "Link to originals via scaled images" or if an original is included for a specific image. 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
    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
    Base name (without extension) of file or folder
    fileName
    Full name of image/movie or folder
    title
    Alternative name for this file or folder, or if not set, same as label
    folderTitle
    Alternative name for this folder
    fileTitle
    Alternative name for this file (v8.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
    resolution
    Original image resolution as written by camera 3
    flash
    If flash was used 3
    focalLength
    Focal length 3
    focalLength35mm
    35mm focal length equivalent3. 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 "texts.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 Headline3
    photographer
    IPTC Photographer 3
    writer
    IPTC writer 3
    author
    Deprecated. use writer instead3
    copyright
    IPTC copyright 3
    gpsLongitude
    GPS longitude in deg°min'sec.dec" format3
    gpsLatitude
    GPS latitude in deg°min'sec.dec" format3
    gpsAltitude
    GPS altitude (height) in meters3
    orientation
    Image orientation. Can be either "normal", "left" or "right"

    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

    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 occurance of $variablesInThisFormat with their current values. This notation therefore works for refering 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 nomatter 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