// uses http://www.gethifi.com/blog/a-jquery-flickr-feed-plugin and
// http://plugins.jquery.com/project/EmbedPicasaGallery
// plus jquery and slimbox etc - see docs for each script above
// I'm using http://headjs.com/ here
// for flickr:
// <ul class="thumbs" name="http://www.flickr.com/photos/username/tags/tagname/"></ul>
// for picasa: <div class="PicasaAlbum">http://picasaweb.google.com/username/albumname</div>
// all picasa albums: <div class="PicasaAlbum">http://picasaweb.google.com/username</div>
// demo using bbcode http://www.reading-forum.co.uk/forum/viewtopic.php?f=20&t=6536
<script>
head.ready(function() {
var APIkey = "xxxxxxFLICKR_API_KEYxxxxxx";
// flickr
$("ul[class=thumbs]").each(function(index) {
//var thisID = $(this).text();
var thisID = $(this).attr("name");
var flickrUser = thisID.split("/")[4];
var tag = thisID.split("/")[6];
$(this).attr("id", flickrUser + tag + index);
$.getJSON("http://www.flickr.com/services/rest/?jsoncallback=?", {
method: "flickr.urls.lookupUser",
url: thisID,
format: "json",
api_key: APIkey
}, function(data) {
$("#" + flickrUser + tag + index).jflickrfeed({
limit: 30,
qstrings: {
id: data.user.id,
tags: tag
},
itemTemplate: '<li>' + '<a rel="colorbox" href="{{image}}" title="{{title}}">' + '<img src="{{image_s}}" alt="{{title}}" />' + '</a>' + '</li>'
}, function(data) {
$("#" + flickrUser + tag + index + " a").colorbox();
});
});
});
//picasa
$("div[class=PicasaAlbum]").each(function(index) {
var thisID = $(this).text();
var picasaUser = thisID.split("/")[3];
var picasaAlbum = thisID.split("/")[4];
if (picasaAlbum) {
$(this).attr("id", picasaUser + picasaAlbum + index);
$.getJSON('http://picasaweb.google.com/data/feed/api/user/' + picasaUser + '?kind=album&access=visible&' + 'alt=json&thumbsize=144c&callback=?', function(data) {
for (var i = 0; i < data.feed.entry.length; ++i) {
if (data.feed.entry[i].gphoto$name.$t == picasaAlbum) {
var picasaAlbumID = data.feed.entry[i].gphoto$id.$t;
//alert(picasaAlbumID);
$("#" + picasaUser + picasaAlbum + index).EmbedPicasaGallery(picasaUser, {
albumid: picasaAlbumID,
size: 144,
// thumb size (32,48,64,72,144,160))
loading_animation: '/forum/jquery.EmbedPicasaGallery/css/loading.gif',
msg_more: 'show<br/>more',
msg_loading_list: 'Loading photos from PicasaWeb',
show_more: 6,
msg_back: 'Back'
});
}
}
});
} else {
$(this).attr("id", picasaUser + index);
$("#" + picasaUser + index).EmbedPicasaGallery(picasaUser, {
matcher: /./,
size: 144,
// thumb size (32,48,64,72,144,160))
loading_animation: '/forum/jquery.EmbedPicasaGallery/css/loading.gif',
msg_more: 'show<br/>more',
msg_loading_list: 'Loading album list from PicasaWeb',
show_more: 7,
msg_back: 'Back'
});
}
});
});
</script>