Configuring image alternatives

Generation of alternative image file sizes/formats automatically is possible via the "$image_alternatives" configuration option. This works in a similar way to video file alternatives.

The setting controls the options fed to the ImageMagick utility when creating that alternative. This is defined as an array. The elements, each defining a format/size, must be numbered sequentially (0, 1, 2). Each block defines several parameters used for the creation of the format/size.

name The display name of the alternative file
filename The filename used when the alternative is downloaded
params Any extra parameters to pass to ImageMagick for example DPI
source_extensions A comma-separated list of the files that will be processed, e.g. "eps,png,gif" (note no spaces)
source_params Parameters for the source file (e.g. -density 1200)
icc If set to true, extract the ICC profile from the source image and use it when generating the target image

For details on supported options, see:


The following configuration will set that three different variations are potentially produced, depending on matches in the "source extensions" parameter. Note the sequential block numbering.

# Example - automatically create a PNG file alternative when an EPS file is uploaded.
# $image_alternatives[0]["name"]="PNG File";
# $image_alternatives[0]["source_extensions"]="eps";
# $image_alternatives[0]["source_params"]="";
# $image_alternatives[0]["filename"]="alternative_png";
# $image_alternatives[0]["target_extension"]="png";
# $image_alternatives[0]["params"]="-density 300"; # 300 dpi
# $image_alternatives[0]["icc"]=false;
# Example - automatically create a CMYK JPEG file alternative from a JPEG or TIFF
# $image_alternatives[1]["name"]="CMYK JPEG";
# $image_alternatives[1]["source_extensions"]="jpg,jpeg,tif,tiff";
# $image_alternatives[1]["source_params"]="";
# $image_alternatives[1]["filename"]="cmyk";
# $image_alternatives[1]["target_extension"]="jpg";
# $image_alternatives[1]["params"]="-quality 100 -flatten $icc_preview_options -profile ".dirname(__FILE__) . "/../iccprofiles/name_of_cmyk_profile.icc"; # Quality 100 JPEG with specific CMYK ICC Profile
# $image_alternatives[1]["icc"]=true; # use source ICC profile in command
# Example - automatically create a JPG2000 file alternative when an TIF file is uploaded
# $image_alternatives[2]['name'] = 'JPG2000 File';
# $image_alternatives[2]['source_extensions'] = 'tif,tiff';
# $image_alternatives[2]["source_params"]="";
# $image_alternatives[2]['filename'] = 'New JP2 Alternative';
# $image_alternatives[2]['target_extension'] = 'jp2';
# $image_alternatives[2]['params'] = '';
# $image_alternatives[2]['icc'] = false;

Offline generation of previews/alternative files

It is recommended that system administrators enable the offline job queue so that users uploading files do not have to wait while previews and alternative files are created.