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’.

Tags: , , , , , , ,

4 Comments

    • Adam
    • April 20, 2009
    • Reply

    Is something supposed to happen in Gallery2 to inform me that Twitter has been pinged?

    This isn’t working for me. I have followed the instructions, yet when I add the “twitter” tag, it adds the tag to Gallery2 and nothing else. My Twitter account remains empty. Any suggestions?

    • Adam
    • April 20, 2009
    • Reply

    Is there supposed to be an acknowledgement from Gallery2 that it has sent the picture to Twitter? Thus far, I have installed the script (following all instructions) but all that happens is that I have a new tag in Gallery2. My twitter remains empty.

    Can you help?

  1. @Adam: No – there isn’t any confirmation from Gallery2 after adding the twitter tag. Have you checked the error_log on your server to see if anything is in there? Are you able to check if the server has php-curl installed?

  2. @Adam you might find this one a little more useful:
    http://www.kevinblake.co.uk/gallerytweet-twitter-for-your-gallery2/530/

    This new plugin *does* provide feedback, and should be a lot easier to setup and working on your Gallery. Let me know how you get on!

Leave a Reply to Adam?