Tuesday, February 26, 2008

This is a quick sample built upon the "JavaScript interface to PicasaWeb Albums" and converted over to jQuery

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="
http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
$.getJSON("
http://picasaweb.google.com/data/feed/base/user/pirklk/albumid/5156711861661192353", {category:"photo",alt:"json"},
function(data){
$.each(data.feed.entry, function(i,item){
$("<img/>").attr("src", item.media$group.media$content[0].url).appendTo("#images");
if ( i == 3 ) return false;
});
});
});
</script>
<style>img{ height: 100px; float: left; }</style>
</head>
<body>
<div id="images"></div>
</body>
</html>

I did not see an easy explanation of the funky data format for PicasaWeb JSON data but the general idea is simple enough.

Kevin Pirkl

No comments:

Blog Archive