Team:Cambridge/Photos

From 2010.igem.org

(Difference between revisions)
Line 2: Line 2:
{{:Team:Cambridge/Templates/headerbar|colour=#386abc|title=Photo Gallery}}
{{:Team:Cambridge/Templates/headerbar|colour=#386abc|title=Photo Gallery}}
<html>
<html>
-
<iframe align="center" src="http://www.flickr.com/slideShow/index.gne?group_id=&user_id=52129837@N08&set_id=&text=" frameBorder="0" width="650" height="500" scrolling="no"></iframe>
+
<script type="text/javascript" language="javascript" src="http://api.flickr.com/services/rest/?format=json&method=flickr.photos.search&tags=viget&tag_mode=all&api_key=52566611a5be16fbbbe57f3dbe4f1fef"></script>
 +
<script>
 +
function jsonFlickrApi(rsp) {
 +
if (rsp.stat != "ok"){
 +
  // If this executes, something broke!
 +
  return;
 +
}
 +
 +
//variable "s" is going to contain
 +
//all the markup that is generated by the loop below
 +
var s = "";
 +
 +
//this loop runs through every item and creates HTML
 +
for (var i=0; i < rsp.photos.photo.length; i++) {
 +
  photo = rsp.photos.photo[ i ];
 +
 
 +
  //notice that "t.jpg" is where you change the
 +
  //size of the image
 +
  t_url = "http://farm" + photo.farm +
 +
  ".static.flickr.com/" + photo.server + "/" +
 +
  photo.id + "_" + photo.secret + "_" + "t.jpg";
 +
   
 +
  p_url = "http://www.flickr.com/photos/" +
 +
  photo.owner + "/" + photo.id;
 +
 
 +
  s +=  '<a href="' + p_url + '">' + '<img alt="'+
 +
  photo.title + '"src="' + t_url + '"/>' + '</a>';
 +
}
 +
document.writeln(s);
 +
//this tells the JavaScript to write
 +
//everything in variable "s" onto the page
 +
}
 +
</script>
</html>
</html>
{{:Team:Cambridge/Templates/footerMinimal}}
{{:Team:Cambridge/Templates/footerMinimal}}

Revision as of 23:53, 17 August 2010