Flickr API - Display Image
in
Integration and Hardware
•
2 years ago
The XML file for Flickr search results doesn't actually display the url with the .jpg name in it - so I'm a little confused at how to get the image to display in Processing. Usually you can just get.Children but again the XML doesn't display the full url for an image. Here's my code so far...
PImage img;
String api = "http://api.flickr.com/services/rest/?method=flickr.tags.getClusterPhotos&";
HashMap<String, Integer> count = new HashMap();
void setup() {
size(800, 800);
//text - Free text search. Searches the title, description or tags that contain this text.
//page - Which page of results you want returned
//per_page - Number of photos to return per page
//api_key - Required to access API
String query = api + "text=cat&per_page=50&api_key=bd7435660785b923332b224789d33c93";
println("Our final query URL:" + query);
println("**********************");
XMLElement xml = new XMLElement(this, query);
XMLElement displayPhoto = xml.getChild("photos/photo");
PImage photo = loadImage( displayPhoto.getContent() );
image(photo, 0, 0, width, height);
println(xml);
}
Can anyone help me out? I'm not interested in using a library I'd just like to keep it simple. Thanks.
PImage img;
String api = "http://api.flickr.com/services/rest/?method=flickr.tags.getClusterPhotos&";
HashMap<String, Integer> count = new HashMap();
void setup() {
size(800, 800);
//text - Free text search. Searches the title, description or tags that contain this text.
//page - Which page of results you want returned
//per_page - Number of photos to return per page
//api_key - Required to access API
String query = api + "text=cat&per_page=50&api_key=bd7435660785b923332b224789d33c93";
println("Our final query URL:" + query);
println("**********************");
XMLElement xml = new XMLElement(this, query);
XMLElement displayPhoto = xml.getChild("photos/photo");
PImage photo = loadImage( displayPhoto.getContent() );
image(photo, 0, 0, width, height);
println(xml);
}
Can anyone help me out? I'm not interested in using a library I'd just like to keep it simple. Thanks.
1