Archives page

Posts Tagged ‘gallery2’

Some Blakepics caption stats

“Nothing motivates people more than celebrating achievements along the way”. I found that on the New Jersey Association of Partners in Education site (NJAPIE for short), so it must be true.

Anyway, I’ve written another of those Gallery2 modules to show some stats on how the 2008 captioning is going. It’s more for my own curiosity and to stop me copying huge reams of SQL into Query Browser. But you never know, you might look at it and say “oh” as well. So, if that sounds like fun you can click Caption Status either here or on the Blakepics left nav.

Your pictures … everywhere

Whilst researching Gallery 2 extensions today, I stumbled across the news that PictureSync now supports Gallery2 as an upload medium. I like having all my photos on my own site, so I can do what I like with them without having to pay through the nose to get at the originals, or worrying about migrating them when the next big thing comes along.

That said, I think I often miss out on some of the more social aspects of photography that networks like Flickr, or Facebook provide. So personally, I’m looking forward to the Windows release of this product so I can try it out for myself. Have any of you Mac users out there tried PictureSync? What did you think?

Inline captioning on Gallery2 /

Approximately 20% of the 17,500 photos on Blakepics have captions of any kind. This can be attributed to a whole number of different things.

  1. I’m very lazy.
  2. I have far too many photos.
  3. I put far too many of them on-line.
  4. Captioning photos on Gallery2 is harder than it should be.

Well, one of my new years resolutions last year was “caption more photos”, and without any specific goals – I can say I succeeded tremendously. So this year I thought I’d quantify it so I can feel ever warmer, fuzzier and smug that I fulfilled an ambition for 2008. So I’m aiming to have captions on a massive 35% of them by years end (that’s a minimum of 2,500 more photos), and to help – I’ve armed with a whole new module. I think I’m finally starting to get to grips with at least some of the Gallery2 API.

So if you have an account on, you can help out by using this new method of adding captions to your photos. Whenever you’re viewing an album you own or have permissions for (and you’re signed-in of course), you’ll notice a new box called “Change Title” below each thumbnail. Just type your new title into that and click the icon to the right, or just hit enter. The image title will be updated without any reloading the page, or taking you to new forms. Which is especially cool if you’re just browsing the photos and want to quickly update something.

I’ve found it a huge improvement, even over bulk-edit – but please let me know your thoughts. And if you’re interested in this module for your own Gallery, please get in touch. It might not be ready for distribution, but I’m happy to hear from any willing beta testers.

Geonaming your Geotags – Automatic picture captions

This time last year, I wrote about how to Geotag your photos using a simple GPS device and oodles of free software. Not much has changed in that process since, except now there’s a lot more software to choose from and the clever folks over at have made it a lot easier to export your GPX tracks.

The spatially-aware web is producing a lot more services for us to use, and now some excellent reverse geocoding functionality. That’s the process of taking geo-data (such as longitude and latitude) and getting place names back. Which is really cool for tagging, titling or adding descriptions to your geocoded pictures.

They provide an impressive array of web services in both JSON and XML ranging from postal code searches, to reverse geocoding based on the community-based Wikipedia entries. And if that’s not enough for you, you can download a copy of their huge database and manipulate it off-line however you want.

So me, I wrote some JavaScript to take advantage of the reverse geocoding and tied it into the Blakepics Gallery2 Tags module. I’ll take the Wikipedia entries as an example, because that returns the most landmarks for me. The example code at the bottom of the page actually makes use of two more web services in addition.

The URL to call the web service is pretty simple enough:

var url = "" + lat + "&lng=" + lon + "&radius=10";

I’ve kept everything in JavaScript rather than building any back-end code whatsoever, so you need to make sure to use the JSON web services and take advantage of the script tags to avoid any cross-domain security policies. The JSONScriptRequest library can be a powerful ally here. This leaves my server to do more important things, but it all depends on your needs for the app.

url += "&callback=showWikipediaNames";
bObj3 = new JSONscriptRequest(url);
// Build the dynamic script tag
// Add the script tag to the page

Then on the callback
function showWikipediaNames(wikijsonData) {
var wikiobjects = wikijsonData.geonames;
if (wikijsonData.geonames) {
for (var i=0;i<wikiobjects.length;i++) {

With me so far? The final step in the process is to add the call to the JavaScript into your Gallery2 templates.

<a href="#" onclick="return showGeoNameOptions(this, {$}, {$block.gpsinfo.LoadGPSInfo.lon});">GeoNames</a>

And before you know it, you have suggestions from geonames on how to tag your photos. Now you can go away and make it suggest some titles and descriptions too. If anyone’s interested in packaging this up into a slightly better Gallery module (or any other application), drop me a line. If this is enough for you, download my example and use it as you see fit.



Mobile Blakepics with Gallery2, AddViaEmail, Gmail, Symbian and Shozu

The plan was to get photos on Blakepics without the hassle of using computers, web browsers, memory card readers, cables, wires or Royal Mail. The secondary goal of the whole thing is to be a bit cool – so naturally it’s a mash-up of a number of different partially connected services, and I’ll briefly mention Facebook just so that we can check that one off and call it Web 2.0.

So, first step – Gallery2 has an AddViaEmail module. Install that, signup for a Google Mail account and get yourself a really obscure email address. Once you’ve got the AddViaEmail installed and configured (yep, it supports Google’s SSL pop3 servers), you can send emails to that address and have them automagically added to a specific album on your Gallery2 server.

You could stop here if you like – most mobile phones come with email software nowadays. So you can write an email, attach your images, and off they go. But I find email on the little keypads really annoying. And there’s all that typing, clicking, and making sure you get things right to worry about. You’re not exactly cutting edge, with email … are you? Besides, we’ve only made use of three different vaguely related services. That’s not what the web of the future is all about. I’ve heard about it in fairy tales.

So, get yourself a Shozu account. They provide a really cool backup / Share-It service and comes complete with a Symbian application which you can install on your brand new ultra-shiny Nokia N95. For example. If you use this, you can get yourself some single-click access to uploading your photos. Actually, it’s a 3-click minimum. But it’s better than typing email addresses or searching for contacts. They provide a bunch of other ways of sharing your photos, such as uploading to the BBC for consideration as part of their stories. Or more usefully to a WordPress blog or Facebook to humiliate your mates before they’ve got home from the pub and had a chance to de-tag all your new compromising photos.

But alas, AddViaEmail and Shozu don’t play very nicely. So, here are some changes to make to your php script (don’t be scared, it won’t bite).

/modules/addviaemail/classes/AddViaEmailHelper.class – Fix problems with the mime type…
list ($ret, $item) = GalleryCoreApi::addItemToAlbum($pathToSaveFile . $filename,$filename, $filename, $summary, '', $mimeType, $targetDestination);
list ($ret, $item) = GalleryCoreApi::addItemToAlbum($pathToSaveFile . $filename,$filename, $filename, $summary, '', 'image/jpeg', $targetDestination);
You’ll also need to disable the subject line spam checker as Shozu will send your email with the subject line as the name of the image.

So just remove this:

$header_info->subject == $subjectToMatch &&

The spam checker is actually quite a cool function, so one of these days I’ll come back an regular expression that. But quite likely, I probably won’t post it here. So work it out for yourself :)

See, and that’s all there is to it. I can now upload loads of photos direct through my phone (as I did with the image at the top of the page), and you could too.