Jun 6, 2012
Get Flickr Galleries from URLs with jQuery
Posted in "development"
I find that I sometimes want to embed a set of images that someone hasn't created a gallery for. You can actually see a slide show of them (example: jQuery Bowling Awesomeness!) but there isn't a way to embed/share that view.. until now. I've created a quick little plugin that grabs the set id and username from a url and then creates the slideshow that gets embedded.
Optional Settings
Example
<div class="wrap"><iframe style="width: 100%; height: 400px" src="http://jsfiddle.net/darcyclarke/dnUyg/1/embedded/result" allowfullscreen="allowfullscreen" frameborder="0"></iframe><span>Fork this Fiddle</span></div>
Code
/**
* Flickr Gallery Plugin
* @author Darcy Clarke
*
* Copyright (c) 2012 Darcy Clarke
* Dual licensed under the MIT and GPL licenses.
* http://darcyclarke.me/
*/
(function($){
$.fn.flickrGallery = function(options){
return this.each(function(){
var settings = $.extend({
url : 'http://www.flickr.com/photos/natecroft/sets/72157629865265552/show/',
height : 350,
width : 350
}, options),
id,
encoded;
id = settings.url.match(/\/sets\/(.*)/)[1].split('/')[0],
encoded = encodeURIComponent(settings.url.match(/\/photos\/(.*)/)[0]);
$(this).append('&lt;embed src="http://widgets.vodpod.com/w/video_embed/Groupvideo.1493771" type="application/x-shockwave-flash" allowscriptaccess="sameDomain" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" flashvars="&amp;offsite=true&amp;intl_lang=en-us&amp;page_show_url='+encoded+'&amp;set_id='+id+'&amp;jump_to=" width="'+settings.width+'" height="'+settings.height+'"&gt;');
});
};
})(jQuery);
Github: jQuery Flickr Gallery Plugin Suggestions, problems, feedback? Check Out the Repo