MAS:Preview Images Manager
The Preview Images Manager is a convenient tool to create additional images for any content set that can be used in any section or gallery template.
Unlike the manually created and uploaded images to the thumbs/ content subfolder, which can be referenced with the
[path] tag in templates, the Preview Manager is providing:
- web interface to select images from the content photo gallery, or upload from local images on your computer, without FTP
- automatic resizing of the selected images, to two pre-defined resolutions, which can be different for each preview image spot
- automatic file naming, following persistent conventions, allowing easy use in templates
- different configurations of number of images and images dimensions, per site.
Configuring the Preview Manager
The configuration file is in the MAS directory on the server, under /interface/common/preview_cfg.php
IMPORTANT: ALWAYS MAKE A BACKUP BEFORE EDITING THIS FILE. A syntax error made in it will make the Preview Manager stop working within the MAS admin. If you do not feel confident about editing php files, contact MAS support for assistance.
You will find a php multi-dimensional array like this:
$PREVIEW_CFG_DOMAINS = array( 0 => array( // Global default options for all sites/domains that do not have their own array of options 'image_sizes'=> array( 1 => "Title 1//135x210//480x720", 2 => "Title 2//250x300//480x720", 3 => "Title 3//100x300//480x720", 4 => "Title 4//135x210//480x720", 5 => "Title 5//250x300//480x720", 6 => "Title 6//100x300//480x720", ), 'video_sizes'=> array( 1 => "Video 1//135x210//480x720", 2 => "Video 2//250x300//480x720", 3 => "Video 3//100x300//480x720", 4 => "Video 4//135x210//480x720", 5 => "Video 5//250x300//480x720", 6 => "Video 6//100x300//480x720", ) ), 1 => array( // Options for Site ID=1 - edit here 'image_sizes'=> array( 1 => "Title 1//135x210//480x720", 2 => "Title 2//250x300//480x720", 3 => "Title 3//100x300//480x720", 4 => "Title 4//135x210//480x720", 5 => "Title 5//250x300//480x720", 6 => "Title 6//100x300//480x720", ), 'video_sizes'=> array( 1 => "Title 1//135x210//480x720", 2 => "Title 2//250x300//480x720", 3 => "Title 3//100x300//480x720", 4 => "Title 4//135x210//480x720", 5 => "Title 5//250x300//480x720", 6 => "Title 6//100x300//480x720", ) ), );
The index in the first array dimension is the ID of the site/domain/ assigned to the primary (master) gallery template assigned to the content set. (If you're not sure what this means, look at the following example: if you want to use the Preview Manager for a content set, edit this set and see which gallery template has been selected. Then go to the Gallery Templates list and see which site this template has been assigned to. Then go to the Si*tes List and look up the ID of that site. This is the ID to use here.)
The values under index 0 are providing global default options which will apply if specific options have not been defined for the site ID of a content set. To add options for a new site, it is recommended to copy/paste the options from an existing one (or 0) and just alter the values.
At the next level there are two similar groups of options, image_sizes and video_sizes. image_sizes apply to the preview images that will be selected from the content set's photo gallery, while video_sizes apply to the preview images that will be manually uploaded from local files (typically, for video content sets that do not have a photo gallery where to choose from). It is possible to have a different number of items within each group.
At the most inner level, the items are defined like this:
1 => "Title 1//135x210//480x720//filename1.jpg",
2 => "Title 2//135x210//480x720",
3 => "Title 3//100x150//---",
4 => "Title 4//150x100//-x-",
- First you have a numbered index 1,2,3,4; required. Then the options are enclosed in double quotes and inside - separated with two slashes.
- The first option is Title (label) - which will be displayed in the Preview Manager interface under the preview image slot, for user convenience.
- The second option is the dimensions of the smaller image in pixels. If it is provided as
-x-the source image will be used as-is, without resizing.
- Next come the dimensions of the larger image. If it is provided as
-x-the source image will be used as-is, without resizing. If it is given as
---it will not be created at all.
- And the last option is the filename of the created preview image. If provided, MAS fill create the small image with the given filename.jpg and the larger image as bigfilename.jpg. If skipped, then MAS will create 1.jpg and big1.jpg using the index number of the preview image.
Configuring the Image Quality
At the bottom of the same configuration file you will see another array, contaning image quality options.
$PREVIEW_CFG_QUALITY = array( 'image_small' => '-unsharp 1.2x2.0+0.8+0.0 -quality 95', 'image_big' => '-quality 70', 'video_small' => '-quality 95', 'video_big' => '-quality 70' )
Separate options can be defined for small and big images, as well as for the ones picked from image gallery and manually uploaded for videos. The option string is anything that can be passed on as filters to Image::Magick, but usually consists of sharpen an/or JPEG quality:
-unsharp 1.2x2.0+0.8+0.0 -quality 95
The values for
-unsharp are: radius x sigma + amount + threshold
Using the Preview Manager
For any content set, except Content Groups, there is an action link Preview Manager in the Content List. The window is split in 3 panes:
- Content Set Gallery, showing the thumbnails of the photo content images if such exist, and if image_sizes have been defined in the configuration file.
- The spots for the preview images, as defined in the config. If preview images have already been selected for this set, they will be displayed there. To replace the image, or add a new one, first click on the spot - its border will be highlighted - then click on a thumbnail from the gallery above. Repeat for all spots, then Save.
- For video content sets, where video_sizes have been defined, use the last pane - you may have to expand it. There you will find preview image spots with a file browse button next to it. Choose local images from your computer, then click Save.
Using the created preview images
First you need a symlink defined in your members (or tour) area leading to <mas_install_directory>/preview/. See this page for more information on the initial site setup.
Then, in any section or gallery template you may refer to the preview images like this:
using the image file names, as they have been defined in the configuration.