Mark's Musings

A miscellany of thoughts and opinions from an unimportant small town politician and bit-part web developer

More photos, and a widget


Emma has been pestering me to add some more recent photos to the gallery, so I’ve finally dug out the circular tuits and added albums from a day out at Trentham Gardens, our summer holiday in Scotland, this year’s Greenbelt and a random selection of autumn-themed photos.

As well as adding stuff to the gallery, I’ve also been playing around with a couple of additions to the code. One of the weaknesses of Gallery2, in my opinion, is that it doesn’t store any meaningful visitor stats – all it records is an overall total of views for items and albums. So there’s no way to see if an item is becoming more or less popular over time, or have any way of making a meaningful comparison between newer and older items. So I’ve hacked the code a bit to make it store a line-by-line record of views, meaning that I can then extract them by date to get a rolling total or see trends. It also means I can get to see who is looking at what, and with what, since it also records IP addresses and user-agents.

The other thing I wanted, but couldn’t find in any of the available plugins, is a Flickr-like photostream widget for Gallery2. So, again, I’ve written my own. Or, to be more precise, I’ve written a script that takes my own stats data and then generates thumbnail links from it that are then formatted into a photostream block. It’s very rough and ready – nothing more than a single page incorporated into WordPress by means of an iframe – and I may well improve it in the future (although, then again, I may not), but it works well enough for now. Those of you reading this article on the blog itself (as opposed to planet.uknot or Facebook) will see the widget at the top of the right-hand column on the front page. Comments are welcome. But no, I’m not releasing the code until it’s undergone a considerable amount of tidying up!