|
Lightboxing and Flickr
2006.07.13 10:01 AM
NOTICE: CONTENTS NO LONGER APPLICABLE The content discussed in this post is no longer valid; as I’m now using a different “lightbox” implementation. JC made me check out his installation of a cool WordPress plugin that does lightboxing. I decided to apply the same stuff in my blog – and modify it a bit to be able to link to the image’s Flickr page somewhat dynamically. ResultsIf you’re not interested in the details, then just spot the difference between these two lightbox-enabled links (I just hope it does work as I intended it to). Here’s an image which I linked to Flickr Here’s an image which I linked to the Gallery within my domian LINK REMOVED (as the old gallery doesn’t exist anymore)If you noticed the difference, and are interested in how I did that – read on…
Lightbox 2.0My first concern was that the lightbox script might require that all your files are locally hosted (meaning coming from the same domain – your/my domain). Of course, given that I try to host my blog images in Flickr now – that certainly will not do. To cut a long story short, it can load hotlinked images – and naturally my next instinct was to incorporate my Flickr linking into the script. Which required a bit of hacking into the Basically, the script (or collection of scripts to be more precise) checks out all so you have code like:
Which it will then create the lighbox instance for and grabs some data into the array. The one I paid attention to was Next was simply just to inject code that does this:
It’s a simple enough task, the only problem is the parsing of the For #3, I used your typical
Which meant:
And voila! you have an instant JavaScript match and replace of any valid Flickr hotlinking post updated on December 1, 2008 @ 7:49 am |
It’s funny their terms of service never crossed my mind – yet I still put linkbacks regardless. Even my older non-lighbox posts actually link to the images’ respective Flickr pages – I guess it’s all thanks to their “notes” feature hehehe.
did you manage to find a code to feed the lightbox with an image set on flickr, and not just a single picture?
i’m really a newbee to this…
tx, Tom
Sorry Tom, I don’t think that’s even possible. There’s no way you can deduce an images’ relation to a “set” in Flickr by just looking at its URL – which is pretty much the only information the Lightbox will get to work with.
Same goes when you work with a set’s URL, there’s no way of deducing from that URL what images fall into it – unless you rig the Lightbox to the Flickr API some way.


Flickr also has a policy that requires a linkback to the page hosting the picture as part of its terms of service. That’s a pretty clever workaround!