Archives page

Posts Tagged ‘blakepics’

GalleryTweet – Twitter for your Gallery2

This post is no longer being maintained due to budget constraints - please check the project page for the latest information: http://codex.gallery2.org/Gallery2:Modules:gallerytweet

I’m releasing the updated module for Gallery2 under the name of GalleryTweet. It was prompted by a few people mentioning they couldn’t get my earlier hack to work – so I thought I’d build something that was (slightly) more robust, and might stand to work on installations other than my own.

You might want to skip my ramblings and jump straight to the download, so here’s a link for you folks:

  1. Install by unzipping to the root of your Gallery2 installation, and activate through the plugins panel.activate
  2. Once logged in, edit your Twitter settings through the left navigationmenu
  3. You should enter your twitter username / password, and the format you’d like to send your Tweets out with.twitter-settings
  4. Now while you’re browsing the Gallery, Tweet about any images using the link below the thumbnailtweet

Please drop me a message on Twitter @kevinblake if you’ve found the plugin useful, can’t get it work, or have any other feedback.  That download link again, in case you missed it the first time:

Happy Tweeting!

This post is no longer being maintained due to budget constraints - please check the project page for the latest information: http://codex.gallery2.org/Gallery2:Modules:gallerytweet

Twitter your Gallery 2

Seems everyone is talking about Twitter nowadays.  The Hudson River picture launched it into the media world as the best news source on the planet, and Obama‘s adoption of the tool has given America the same pleasure that Britain experienced when our Prime Minister, Stephen Fry starting getting ‘back in touch with the people’, in October 2008.

The Hudson River picture wouldn’t have been possible without the non-affiliated TwitPic – which never truly got the recognition it deserved.  Without it, the infamous picture would have only been a 140 character description, and nobody will have noticed or cared.  Still, that’s the nature of buzzwords I guess.  If they don’t cause a buzz, they’re just words.

Anyway, TwitPic is yet another disparate service like Flickr, Panoramio or Facebook that’s had me tempted away from uploading some of my photos to Gallery2 / Blakepics.  With Facebook, I’ve integrated my own application there; Panoramio and Flickr, stolen the best parts of each.

And now with a hack to the tagging module in Gallery 2 I can emulate all I want from TwitPic as well, and tuck another service onto the shelf at the back at the cupboard.  So as usual, I thought I’d share.

What it is…

  • Tweet any photos on Gallery just by adding the tag ‘twitter’ to your photo.
  • Automatically takes the photos title as your Tweet text.
  • Processes all URLs through TinyURL, giving you a warm and fuzzy Tiny URL

What it isn’t…

  • A seamless Gallery2 module.  There’s some hacking to do.
  • Multi-user.  If you share your Gallery, there’s some more work to do.

If you make improvements in these areas or any others – please let me know 🙂

Requirements

Things you need to do

  1. Download my Twitter Tags class
  2. Unzip to the root of your Gallery installation
  3. Edit /modules/tags/classes/TwitterTag.class with your twitter username/pass, and Gallery URL.
  4. Edit /modules/tags/classes/TagsHelper.class
    1. Add this just above the line ‘class TagsHelper’
      GalleryCoreApi::requireOnce('modules/tags/classes/TwitterTag.class');
    2. Then just above
      return TagsHelper::assignTagById($itemId, $tagId);
      Add
      TwitterTag::Tweet($itemId, $tagId);
  5. Tag any photos you want to appear on Twitter with ‘twitter’.

Statistical New Years Resolutions on Blakepics

Last year, like the year before that, I made a resolution to caption 35% of the photos on Blakepics (up from 20%). There were 4,040 photos added over the past year, and approx. 25% of all photos are now captioned. So I didn’t reach my goal. 1,344 photos were captioned, and if it weren’t for all those new ones it’d be standing at 30%.

Fortunately, BBC News have now deemed New Years Resolutions to be bad for your health.  So like bread, second-hand smoke, guilt and vitamins, I’ve given them up.

But I thought to myself, “I’ve been captioning loads of photos every week”.  I did.  “I bet it’s the rest of those free-loaders not pulling their weight”.  So I’ve given the Caption Status page on Blakepics a much-needed overhaul.  If you’re logged in, you’ll now see how you’re doing with captioning your own photos – and even if you’re not, you can see a member list with how many photos everyone’s captioned, as well as click-through to a list of them all.

Turns out I was wrong.  A lot of those free-loaders are doing a better job than me.  In fact, whilst 25.01% of total photos are captioned – 25.04% of my own photos are captioned.  Since most of them on there are mine, I guess I shouldn’t be surprised.

So it seems as though I can’t prove everything with statistics.  Not if that something is how successful my 2008 Resolution has been.

Happy New Year Everyone!

Automatically Geotagging your Gallery

Tags from Blakepics

Automatically add geonames.org tags to Gallery

As always, an imminent holiday has inspired me to update the entire system behind geotagging my photos.  Likewise, needing to plan said holiday has given me the opportunity to procrastinate and do something else instead.

Wishlist

  • A repository I can drop files created by the Genie BGT-31 GPS tracker.
  • Automatically convert the tracks into GPX format.
  • Automatically stamp any photos within Blakepics with their longitude / latitude values into the EXIF information.
  • Use that EXIF information to populate the database for the Gallery2 maps module.
  • Use geonames to get some basic tags, and automatically add those to the tags database.

I can happily report all of the above is happily running on a schedule on the Blakepics server.   Whilst I realise a lot of these options aren’t particularly available on a shared hosting server, I’m going to talk about them anyway.

A small disclaimer

Be under no illusion, a lot of these scripts are hacked together with no thought given to scalability, stability, or re-use.  They’d be a lot better off as a proper Gallery2 module to be honest – and hopefully someone will beat me to it in making that a reality.  However, for the time being – this is all provided as-is 🙂

NMEA repository

The repository is quite simple with an SFTP server running (sshd for example), and FileZilla on the client

Convert the tracks to GPX

  1. Install the rather excellent gpsbabel.
    yum install gpsbabel
  2. Run this convert-to-gpx.pl.txt perl script to combine all your nmea tracks to create a single gpx file.

Stamp the photos

  1. Get the gpsPhoto perl script.  You might find you need to install some perl modules:
    perl -eshell -MCPAN
    install modulename
  2. Use this geocode-photos.pl.txt script to find any matching photos from your Gallery, and tag them.  Note that I limit them to only photos I’ve uploaded myself, as I don’t want to go messing around with other peoples (and they were probably not at the same location anyway)

Fill the Gallery2 maps module with the EXIF data

There’s a maintenance task to use the EXIF data to power the maps module of Gallery2, so using Roel Broersma’s excellent script to run the maintenance tasks, these can be scheduled with the extra line:

wget --quiet --output-document=/dev/null --cookies=on --load-cookies $TMP_PATH/myg2cookies "$G2_URL/main.php?g2_controller=core.AdminMaintenance&g2_form%5Baction%5D%5BrunTask%5D=1&g2_taskId=PopulateGPSEXIFInfos&g2_authToken=$AUTHTOKEN"

Give some meaning to your location data with geonames

Geonames provides a reverse-lookup to get some more human readable descriptions of your photos.  So I use this to put in the country, region and town data into my Gallery.  You can go a bit further and get details of nearby landmarks from Wikipedia to add if you like, but i don’t find it too useful for my purposes.

  1. You’ll need some more perl modules
    perl -eshell -MCPAN
    install Image::ExifTool;
    install Image::ExifTool::Location;
    install Geo::GeoNames;
    install Data::Dumper;
  2. Get my write-geoname-tags.pl.txt perl script, which is actually a combination of all the previous scripts.  This will query the web service, and update your tags.

It all sounds very complicated…

Well, yes.  My aim isn’t to create the easiest system to set-up, it’s to create the easiest system to use.  Uploading a single NMEA track list now causes all of the above to happen automatically.  That said, I recognise that it’s not for the faint-hearted.

So why not try one of these easier solutions:

What next?

Add all of these scripts mentioned above to a cron task, and forget all about it.  You can probably combine the whole lot into a single job (I wanted to keep them separate, so some could be run nightly, and others weekly or monthly).

Hopefully this is the humble beginnings of a more efficient and elegant solution.  For now I’m at least getting a lot more data into and out of my photos

Do let me know if you make any improvements, or have any ideas for viable new features – I’d be interested to hear from you.

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.