I wanted an easy way of using images from a Zenphoto gallery in MediaWiki pages, and it turned out there wasn’t one. In fact, I had trouble finding a hard way of doing it with satisfactory results. It’s easy enough to embed external images in a MediaWiki page, if you have your MediaWiki config set to allow it, but I wanted thumbnails that clicked through to the real image. Not so easy. Hence MWZenphoto – a very basic MediaWiki extension that lets you do just that by including a simple <zenphoto> tag in the wiki markup.
Installing is straightforward – get the MWZenphoto.php file from the project repository and put it in MediaWiki’s ‘extensions’ directory. Then add the following to LocalSettings.php:
require_once('extensions/MWZenphoto.php');
Finally, in MWZenphoto.php, edit the following line so it points to the Zenphoto gallery you want to use:
$ZP_baseURL='/gallery';
You can give it a relative path, like I’ve done there, if Zenphoto and MediaWiki are on the same server. Alternatively, you can give a full URL, such as ‘http://somewhere.else.example.com/path/to/gallery’.
Once it’s installed, you can use the <zenphoto> tag directly in the wiki markup. In its simplest form, you just need to specify the album and image name, like this:
<zenphoto>album|image.jpg</zenphoto>
You can also specify the thumbnail size, the image alignment, and the alt text, and the image can be more than one album deep in the Zenphoto heirarchy. A more complex example:
<zenphoto>album/subalbum|image.jpg|350px|right|alt=A picture</zenphoto>
In all cases, clicking the image takes you to the Zenphoto page for that image. Finally, see here for a working example. This is very much a first draft – maybe it needs some tweaking to fit in with your Zenphoto configuration, maybe it’s got a bug, or maybe it needs a feature. Let me know.
-
Pingback from Zenphoto » Hacks, addons and utilities on October 8, 2009 at 14:38
-
I see that the information enumerated here is at least 2 years old now. Has anyone done more with Zen Photo and MediaWiki since?
thank you

5 comments
Comments feed for this article
Trackback link: http://ciarang.com/posts/mwzenphoto/trackback