Sorcerer's Gallery blocks are added to areas, pages and stacks in the usual way.
In the edit dialog, the title of the gallery and all files in the gallery are entered using Magic Data expressions.
The title is optional. If you don’t want to show a title, just leave it empty. Where you don't want to use a more involved Magic Data expression, simply enter the text you want. If it contains spaces, enclose it in quotes. Depending on your Magic Data settings, you may also need to precede such text with SET.
The title and content entry fields of the block edit dialog have a built in symbol tester that you can use to quickly test Magic Data expressions against specific pages and users (you can also use the symbol tester in the dashboard).
Now we come to the important part. The content field must evaluate a list of files. In its simplest form, this could be a direct listing of a fileset. Suppose you add all the Greek Yogurt banner files to a set called 'Banners'. You can then list that set using the expression:
SET 'Banners' AS_FILESET LIST_FILES 15
There are 7 files in the set, so 15 allows for a few extra.
On the Image Details tab, select how individual images are sized and cropped. If you want an automated show you can pick a transition speed, or leave that slider 0 for manual transitions.
Looking ahead, if you plan to use the default template (a fancybox based gallery), or another thumbnail based gallery, the dimensions set here are for the size of the thumbnails.
If you plan to use one of the slideshow, slider or list templates, the dimensions set here are for the actual image size.
Some gallery templates provide a title overlay or insert. For templates that support it, selecting 'Show individual file titles' will enable that title overlay. From v1.1 of Sorcerer's Gallery, a further option is to show the file description in place of where the title would be shown.
Save the block, select a template, and away you go.
More involved file selection
Getting more involved, supposing you want to specify a stack that will show a different file set depending on what page it is on. You could create a page attribute 'Page Gallery Set' and set that to a fileset name or use a filset picking attribute addon and pick a fileset.
Then, in your stack, set up a Sorcerer's Gallery block with the Magic Data expression
PAGE ATTRIBUTE 'Page Gallery Set' AS_FILESET LIST_FILES 50
When added to a page, the galley will get the fileset to display from the page attribute.
A similar trick can be used in association with a user attribute to show the owning users favoured fileset on a user profile page. Create a user attribute called 'My Gallery Set', then in an editable content area of a user profile page you can do:
PROFILE ATTRIBUTE 'My Gallery Set' AS_FILESET LIST_FILES 50
Such uses of Sorcerer's Gallery can be usefully paired with Front End File Uploader to read the same attribute and upload files directly into the associated filesets. If you have a lot of users, you can automate the creation and naming of each user gallery with Black Magic Data.
Multiple filesets can easily be added to a gallery by merging into a Magic Data memory:
SET 'My First Set' AS_FILESET LIST_FILES 50 MERGE_INTO 'gallery_files' SET 'My Second Set' AS_FILESET LIST_FILES 50 MERGE_INTO 'gallery_files' SET 'gallery_files' RECALL
You can also add individual files
SET 'My Basic Set' AS_FILESET LIST_FILES 50 MERGE_INTO 'gallery_files' SET 'my_additional_file_one.jpg' AS_FILE MERGE_INTO 'gallery_files' SET 'my_additional_file_two.jpg' AS_FILE MERGE_INTO 'gallery_files' SET 'gallery_files' RECALL
On an eCommerce site, if you also have Magic Data Commerce, you could set up filesets of additional product images selected by a product attribute. You could then set up a stack containing a Sorcerer's Gallery that, when added to a product page, automatically showed the additional images for the product on that page.
CURRENT_PRODUCT ATTRIBUTE 'Additional Image Set' AS_FILESET LIST_FILES 50
For those wanting to get really advanced, Magic Data also includes symbols for iterating through lists (filesets), filtering and basic conditional expressions, so the construction of the content for a gallery can be even more adaptive.
Last updated: over a year ago