Thumbnails

back to index

In the global configuration file, you can specify as many thumbnail sizes as you want. For each size, you must specify:

An example configuration could be:

<thumbnail
name="thumbnail-medium"
max-size="200"
store="true"
default="true"
prefix="thumbnail-med-"
/>

What does all this mean?

Thumbnail Configuration Name

The thumbnail name (in the above example, "thumbnail-medium") is the message name that will be displayed to the user in the combobox that allows him to select that size. Please note that the name is not the text to be shown, but the key to use to find the real text, which is specified in the message files. (See "internationalization" for a description of how this process works).

Thumbnail name

In this case, in the message file we have the "Medium (200x150)" text for that thumbnail name.

Maximum Size

The maximum size of a thumbnail is the size in pixels of its longest dimension. The other is calculated so that the ratio of the original photograph is preserved. Let's say you have a photograph that is 1096x2048. That's a width/height ratio of 0.53. So if you specify a maximum thumbnail size of 200, the photograph will be rescaled to 107x200.

Storage and Prefixes

You can specify whether thumbnails are stored or not. Initially, unless you pre-generate all thumbnails, only the original photographs themselves exist on the hard drive. When a user views a thumbnail, if it doesn't exist on the disk it is generated on the fly. Now, this is a lengthy process (not in absolute terms, but in comparison with other processes) and if you are serving many users you might want to reduce the process time per user as much as possible. JPBlog allows you to specify in the configuration file that generated thumbnails are stored on the drive for reuse. The prefix parameter controls what name is used when storing the file. If the prefix is for example "th" and the original photograph is "Athens.gif", then the thumbnail will be stored as "thAthens.jpg".

The thumbnails are always generated as JPEG files with a "jpg" extension.