2 header("Cache-Control: no-cache");
\r
3 header("Pragma: no-cache");
\r
4 header("Expires: ".gmdate("D, d M Y H:i:s",time()+(-1*60))." GMT");
\r
5 header("Content-type: text/xml");
\r
6 echo "<"."?xml version='1.0' encoding='UTF-8'?".">\n";
\r
8 include("../../plugins/php/class.xml.parser.php");
10 // -----------------------------------------------------------------------------
11 // This script takes a "tags" parameter from the query string
12 // and returns a list of flickr photos with that tag in the Rico LiveGrid format
14 // PLEASE USE YOUR OWN FLICKR API KEY
15 // Get one at: http://flickr.com/services/
17 // Created by Matt Brown, Dec 2007
18 // -----------------------------------------------------------------------------
20 $flickrKey="3773d42a5766f0bd27caa1d584ae0bc9";
\r
21 $id=isset($_GET["id"]) ? $_GET["id"] : "";
\r
22 $tags=isset($_GET["tags"]) ? $_GET["tags"] : "";
24 echo "\n<ajax-response><response type='object' id='".$id."_updater'>";
\r
26 print "\n<rows update_ui='true'>";
28 $url="http://api.flickr.com/services/rest/?method=flickr.photos.search";
31 $url.="&safe_search=1";
32 $url.="&tag_mode=all";
33 $url.="&sort=interestingness-desc";
34 $url.="&extras=date_taken,owner_name,geo,tags";
36 $url.="&api_key=".$flickrKey;
37 $parser = new xmlParser();
39 $status=$parser->output[0]['attrs']['STAT'];
41 // FOR DEBUGGING PURPOSES
44 //print_r($parser->output);
47 $content=&$parser->output[0]['child'][0]['child'];
48 foreach ($content as $item) {
49 if ($item['name'] == "PHOTO") {
51 // "_s" suffix specifies a 75x75 pixel format
52 $photourl="http://farm".$item['attrs']['FARM'].".static.flickr.com/".$item['attrs']['SERVER']."/".$item['attrs']['ID']."_".$item['attrs']['SECRET']."_s.jpg";
53 //print "<p><img src='".$photourl."'>";
54 print XmlCell($photourl);
55 print XmlCell($item['attrs']['TITLE']);
56 print XmlCell($item['attrs']['OWNERNAME']);
57 print XmlCell($item['attrs']['DATETAKEN']);
58 print XmlCell($item['attrs']['TAGS']);
65 print "\n"."</rows>";
\r
66 echo "\n</response></ajax-response>";
68 function XmlCell($value) {
\r
69 return "<td>".htmlspecialchars($value)."</td>";
\r