How to use the Dynamic Albums feature Sep 08, 2008 / Updated: Jul 31, 2015
Dynamic album basics
Albums in Zenphoto are physical and based on a folder on the file system. Dynamic albums are albums created dynamically based on a search, so technically a saved search. Therefore they update themselves if the search returns new results.
Dynamic albums are on the file system represented as a text file
<albumname>.alb. The suffix
is shown in the url if there is a physical album of the same name,
otherwise the suffix is omitted (1.4.3).
Note that usage of dynamic albums requires Cookies to be enabled in the visitor's browser to stay in search context.
Note: Dynamic albums cannot have subalbums unless these are part of the search results.
on image file names: With Zenphoto 1.4.6 the url scheme of
images within an dynamic album changed. Formerly they had the
name of their real album in the image page url. Now they have the
name of the dynamic album. The benefit is that you now can link to
an image within an dynamic album directly and behave like a real
This however introduces the limitation that you cannot use images with the same filename but from different real albums within an dynamic album anymore. Actually you can but it will confuse pagination links and thefore your users as these images will all have the same url.
If you intend this feature be sure you use unique file names for all of your images within all albums.
Creating a dynamic album
From a search
To create a dynamic album just perform a search.
- This will return a page with your search results. On that page
(assuming you are logged in) is an admin toolbox link and clicking
on that link will reveal a create album link.
- After you have clicked on that, you will be able to make
an album out of your search. You can then set several options what
to use to create the album (tags, title, descriptions etc).
- After that you can refine some search options and the
- You can also change its sort order within the other albums,
just like with any other album. A dynamic album of course may be
the subalbum to a physical album.However it naturally cannot
have direct subalbums itself but the search result of course may
contain albums if the search is set that way. Dynamic albums use
other icons so you can identify them in the list.
- On the gallery itself the album is also shown like any other.
Since they are "saved searches" you cannot sort its images manually
though. You can however set general sort orders like by title, date
Directly on the backend (since 1.4.8)
You can create a dymamic album directly on the album edit pages without a prior search by using the button of the same name.
To refine the dynamic album creation you somehow have to identify the pictures you want to collect. The simplest way it to give them a common unique tag. Then perform a search and proceed as described above.
Setting up the dynamic album context manually
As dynamic albums are saved searches you need to access the album page of the dynamic album to create this special context. From Zenphoto 1.4.3 on it is possible to manually set the context by using this code:
<?php zp_load_album('<your dynamic album name>'); prepareAlbumPage(); ?>
For the same reason you also cannot link directly to an image within an dynamic album as that will always get the image within its original album. To setup an image context - in this example the first - while staying within the dynamic album you additionally need to do:
<?php $firstimage = $_zp_current_album->getImage(0); $firstimagealb = $firstimage->getAlbum(); zp_load_image($firstimagealb->name,$firstimage->filename); prepareImagePage(); ?>
This text by www.zenphoto.org is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.