Created
April 8, 2010 01:01
-
-
Save ydn/359646 to your computer and use it in GitHub Desktop.
fetch flickr photos in javascript & put them on a page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- fetch flickr photos in javascript & put them on a page. Based on Jon LeBlanc's PHP code: http://developer.yahoo.net/blog/archives/2010/04/building_flickr_urls_from_yql_flickrphotossearch_results.html --> | |
<body> | |
<script> | |
function cbfunc(obj){ | |
for(var i = 0; i < obj.query.results.photo.length; i++){ | |
var farm = obj.query.results.photo[i].farm; | |
var server = obj.query.results.photo[i].server; | |
var id = obj.query.results.photo[i].id; | |
var secret = obj.query.results.photo[i].secret; | |
var img = new Image(); | |
img.src = 'http://farm'+farm+'.static.flickr.com/'+server+'/'+id+'_'+secret+'.jpg'; | |
document.body.appendChild(img); | |
} | |
} | |
</script> | |
<script src='http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20flickr.photos.search%20where%20has_geo%3D%22true%22%20and%20text%3D%22ucsd%22%20and%20safe_search%3D%22true%22&format=json&diagnostics=false&callback=cbfunc'></script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment