NZ Techonverse: Simple PHP Photo Gallery For NZ Rail Maps Volumes Site

First published on NZ Techonverse

The New Zealand Rail Maps Project aims to create free maps of the present and past national public railway network, which are produced and distributed by a variety of means, through several web sites. One of these is the Volumes site, and it is intended to distribute individual images that each represent a small part of a map. A collection of these images makes up an individual Volume, or part of a Volume; there are 12 Volumes that cover the whole of New Zealand. At the moment the Volumes site, like most of the NZ Rail Maps sites, is implemented as a WordPress blog. However, the key issue for implementing an image gallery site – as Volumes effectively is – in WordPress is to find a suitable way of implementing the image gallery. So far I have trialled and evaluated a number of different WordPress options, including its built in media library system and numerous plugins, but generally I am inclined to reject them all. WordPress’s built in option fails on the grounds that there is only one hosting option and that is on WordPress’s own servers, which makes it difficult to organise and maintain the individual collections. All the plugins fail on the basis that they are not open source and require subscription fees. This creates lockin to their platform and perpetual expense. Moreover, they have many features well in excess of what I need, and customisation of the sort that I might desire would be dependent on their development priorities.

I quickly reached the conclusion it is easier to start with a simple non-Wordpress photogallery in PHP and perhaps I can write my own plugin to integrate it to the WordPress front-end of the site. All I really need is to display the thumbnails and then link to full images, which are dynamically generated from folders on my server. Having left and right arrows in the full page display will be useful, perhaps not in the first stage but later. Above all, I want a hard URL for each image. This means I don’t need tricky features like Javascript, as nice as they are for online browsing and scrolling especially on mobile devices. The assumption is for that capability, there’ll be the option to download the volume onto a device, although this capability will not exist in the first stage. There will also not be WordPress integration in the first stage.

An open source package called “Foliogallery” looks like it can do what I want, with some simplification. It displays some confusing design features that I want to dump as quickly as possible. Mostly, the designers have created a Javascript viewer that displays images inline, without giving them a hard URL, but if you open the thumbnail’s link in a new tab or window, you’ll get a non javascript version with the URL. Maybe it’s clever, but tricky if you don’t want the javascript. So developing this for me is requiring me to figure out how to dump the javascript viewer, and possibly create my own full page viewer PHP script.

This gallery system also has the capability to automagically create thumbnails assuming the script is given write access to the thumbnails folder. My preference is not to grant that access (for various including security reasons) and create the thumbnails manually. Here, there are many packages in Linux I can use to do this. My choice will be Converseen, an open source GUI that is available in the default Debian repository. Back in the day I would have used a nice Windows GUI called IrfanView, which is not available for Linux, nor have I found anything else that is nearly the same.

Read More