Using plugins and third party features May 26, 2013 / Updated: May 15, 2019
Installing third party plugins
Official plugins and extensions reside within /zp-core/zp-extensions. You should never remove official plugins as they might be used internally, too. You also should never install third party plugins there. Instead you need to install them within the root /plugins folder.
Zenphoto plugins consist at least of one file <pluginname>.php. It may optionally use a folder with the same name within the plugins folder that contains files for extra functions, css files or images. Example:
plugins/<yourplugin>.php plugins/<yourplugin>/ (contains additional files needed by your plugin)
If you download a (third party) plugin and uncompress (unzip) it you will often have the file or the file and folder within another folder. Don't upload that folder but only its content as shown above to the /plugins folder directly. The third party plugin should now show up on the plugins tab on the backend.
Some plugins do use filters and add their functionality themselves. Please refer to the plugin's instruction how it works.
But not all themes are setup with all plugin features because they are optional. On our themes page your can see which specific plugins are supported in the available themes.
This means you might have to add some of them to your theme files yourself. This is generally very easy as it is mostly just adding one extra line of code where you want the plugin's feature to be visible.
Important is that you also add additonal checks in case the plugin is disabled and its functions are not available. This would break your site. There are several ways to add those checks:
a) General plugin check:
b) For a specific plugin function:
c) If the plugin (as recommended) uses a specific class:
d) A combined solution for b) and c):
More info on the native PHP function call_user_func() here.
It is recommend to have at least basic PHP knowledge before adding theme functionality.
Some links on how to learn how to do that:
Adding third party features to Zenphoto
In addition to theming, Zenphoto has a plugin architecture that lets third party developers add capability to the gallery. In addition, many of the standard features can be enhanced by the addition of specific files. As from Zenphoto release 1.2.7 we have separated as much as possible the standard Zenphoto files and scripts from ones that are otherwise provided.
New themes can be added as folders in the root themes folder. With release 1.2.7 the plugins folder has been moved into the root. It is entirely for third party extensions to Zenphoto. Zenphoto standard plugins now reside in the zp-core/zp-extensions folder. You can now remove a few root files, the zp-core folder, and the theme folders of Zenphoto distributed themes prior to uploading a new version and insure that your new install will not contain any legacy Zenphoto scripts.
There are several folders included in the plugins folder for adding standard features to Zenphoto. These are:
- gd_fonts -- Captcha and the text-watermark plugin can make use of custom fonts. You can add fonts by placing them in this folder.
- imagick_fonts -- Same as above.
- watermarks -- Place images you wish to use for watermarking in this folder.
Setting up a theme for Colorbox
If you wish to display the full image using the Colorbox plugin, you probably need to modify your theme if it does not already have support for it. Just enabling the plugin is not enough otherwise. It is recommended to read the theming tutorial for theming basics.
You can look at the Zenpage theme's image.php for an example usage. Several examples and detailed info on configuring Colorbox are available on the Colorbox site itself.
If you wish to link the thumbnails on the album page directly, bypassing the image.php page, you need to do the above and also change the link within the next_image() loop to link to the full image. Mika Epstein (Ipstenu) has written a detailed tutorial about this.
Note that this will only open the images of the current page. If you want to open all images in the album you need to modify your theme quite a bit to print invisible links of the other pages' images. This will require some more advanced Zenphoto and PHP knowledge using the Zenphoto object model framework.
This text by www.zenphoto.org is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Code examples are released under the GPL v2 or later license