How to Enable a Sitewide Lightbox Effect for WPMU with Easy Flickr Integration

December 18, 2009  | 
1 Comment

I love hacks that benefit WPMU so I’m always on the hunt to find ones that will be helpful to our readers. If you’ve ever experienced the frustration of getting a lightbox effect for images to be site-wide on your installation, here is your answer. This is a slightly hacked version of the Slimbox plugin by Brajesh Singh of Thinking In WordPress. Grab the zip file of the plugin here. Unzip and upload the files slimbox.php and the folder “slimbox” to wp-content/mu-plugins directory. That’s all you have to do. It will automatically be activated site-wide.

walter

The original plugin is located here: http://wordpress.org/extend/plugins/slimbox/ Why do we like Slimbox? It’s standards-friendly. It allows you to quickly navigate through a gallery without bugging out. It has a lot of customizable options, including changing the duration of any of its effects. You can style every visual aspect of the plugin using CSS. However, the greatest feature is its powerful API, which easily interfaces with any links pointing to Flickr or Picasa or any JavaScript image gallery. The ability to build this effect into your installation while allowing your users to display images from 3rd party image hosting providers will save you all kinds of disk space. This is especially true if you’re hosting a social network where members will want to share their photos.

Quick Example with Flickr and WPMU:

If you install a flickr widget, such as this one, and make it available to your blog users, they can easily enter their Flickr RSS and have their stream displaying in the sidebar of their blog. Ordinarily, these photos open up on a new page at Flickr, but you want them to open on your site using slimbox. You can achieve this by using a linkMapper function with jQuery. Because Flickr has a uniform link suffix, Twitter Tools & Apps, depending on the size of the image, i.e. /sq, /t, /s, /m, /l, it is simple to map the thumbnails to the larger images and tell them to make a slimbox gallery of them. Here’s the JavaScript you need to get the Slimbox working together with Flickr. It works perfectly with WPMU:

<script type="text/javascript">
jQuery(function($) {
        $("a[href^='http://www.flickr.com/photos/'] > img:first-child[src]").parent().slimbox({}, function(el) {
                return [el.firstChild.src.replace(/_[mts]\.(\w+)$/, ".$1"),
                        (el.title || el.firstChild.alt) + '<br /><a href="' + el.href + '">Flickr page</a>'];
        });
});
</script>

Steps in Review:

1. Install the Slimbox Plugin that has been hacked for WPMU.

2. Install a Flickr Widget for WPMU.

3. Add the JavaScript shown above to the header.php file of your theme.

If you pull this widget into BuddyPress, I imagine that you can set up a decent gallery that allows users to drop in their Flickr RSS and have their photos shown on their profile with Slimbox, instead of opening at Flickr. Maybe we’ll do a tutorial on that if there’s any interest. :) There are BP gallery plugins coming onto the scene, but if you don’t want the hassle of hosting your member’s images, try using the Slimbox API to utilize a 3rd party image hosting service.

Featured Plugin - Open an Online Store with MarketPress

Out of all the WordPress ecommerce plugins available, this has got to be the winner - easy to configure, powerful functionality, multiple gateways and more. A simply brilliant plugin!
Find out more

Featured Plugin - Host sites, get paid, just like WordPress.com

If you've ever wondered how you could offer a paid site management and hosting service, then this is the plugin for you. Offer a freemium or paid service, for any niche you like, it's powered Edublogs.org to success already!
Find out more

Featured Plugin - Start Your Own Powerful Membership Site

If you're thinking about starting a paid, or just private, membership site then this is truly the plugin you've been looking for. Easy to use, massively configurable and ready to go out of the box!
Find out more

Featured Plugin - Every great SEO tweak you need, in one snazzy bundle

Fully integrated with the SEOMoz API, complete with automatic links, sitemaps and SEO optimization of your WordPress setup - this is the only plugin you need to help you rank your site number 1 on Google - nothing else compares.
Find out more

Featured Plugin - Turn any WordPress page into a fully featured wiki!

To get a wiki up and running you used to need to install Mediawiki and toil away for days configuring it... not any more! This plugin gives you *all* the functionality you want from a wiki, in WordPress!!!
Find out more

Featured Plugin - Easily integrate your WordPress site with Facebook

Would you like to add Facebook comments, registration, 'Like' buttons and autoposting to your WP site? Well, The Ultimate Facebook plugin has got that all covered!
Find out more

Featured Plugin - Send beautiful html email newsletters, from WordPress!

Now there's no need to pay for a third party service to sign up, manage and send beautiful email newsletters to your subscriber base - this plugin has got the lot.
Find out more

Featured Plugin - Start your own Quora / StackOverflow / Yahoo Q&A site

It's now incredibly easy to start your own Q&A site using nothing more than WordPress - The Q&A plugin simply and brilliantly transforms any site, or page, into a perfect support or Q&A environment.
Find out more

Featured Plugin - WordPress + Google Maps = Perfect

Simply insert google maps into posts, sidebars and pages - show directions, streetview, provide image overlays and do it all from a simple button and comprehensive widget.
Find out more

One Response to How to Enable a Sitewide Lightbox Effect for WPMU with Easy Flickr Integration

  1. Pingback: blog1 » Andorinha

Click on a tab to select how you'd like to leave your comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting