We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › Getting photos from Picasa, Flickr, etc
Page Index Toggle Pages: 1
Getting photos from Picasa, Flickr, etc (Read 2279 times)
Getting photos from Picasa, Flickr, etc
Apr 21st, 2010, 5:17pm
 
Hi,

Is there any library to get photos from websites such as Picasa, Flickr, or any other? Smiley
Re: Getting photos from Picasa, Flickr, etc
Reply #1 - Apr 22nd, 2010, 1:10am
 
Have you tried a little search on the forum?
Or on Internet, in case such library exists in Java?

I don't know if such unifying library exists, if not, you probably have to use the Web API provided by each service.
Re: Getting photos from Picasa, Flickr, etc
Reply #2 - Apr 22nd, 2010, 6:49am
 
Flickrj seems to be dead, and this post (http://processing.org/discourse/yabb2/num_1159054255__doesn.html't talk about a concrete library :S

guess that's a no

Re: Getting photos from Picasa, Flickr, etc
Reply #3 - Apr 23rd, 2010, 9:25am
 
There's not a flickr library per-se, however you can user Flickr's API and use processing's XML library to interface between the both of them. There's a chapter in Joshua Noble's book - Programming Interactivity that talks about this. Look up the Flickr API to start with!

Tim
Re: Getting photos from Picasa, Flickr, etc
Reply #4 - Apr 26th, 2010, 2:26am
 
Thanks Smiley I'm also using:

http://www.bryanchung.net/?p=189
Re: Getting photos from Picasa, Flickr, etc
Reply #5 - Apr 26th, 2010, 6:49am
 
Having some trouble with the code from that link, I'm now trying to use flickrj. I managed to get this code working:

Code:
import com.aetrion.flickr.*;
import processing.core.*;
import org.xml.sax.SAXException;
import com.aetrion.flickr.contacts.*;
import com.aetrion.flickr.people.*;
import com.aetrion.flickr.FlickrException;

String apiKey = "####";
Flickr f;
ContactsInterface c;
PeopleInterface p;

void setup() {
size(1360, 768);
background(255);

f = new Flickr(apiKey);
c = f.getContactsInterface();
p = f.getPeopleInterface();
User u;

try {
u = p.findByUsername("Augusto Esteves");
Collection co = c.getPublicList(u.getId());
Iterator it = co.iterator();

while(it.hasNext()) {
Contact contact = (Contact) it.next();
println(contact.getUsername());
}
} catch (IOException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (FlickrException e) {
e.printStackTrace();
}
}

void draw() {
}


Now I'm trying to figure out how to draw images according to their tags Undecided
Re: Getting photos from Picasa, Flickr, etc
Reply #6 - Apr 26th, 2010, 9:58am
 
Code:
import com.aetrion.flickr.*;
import processing.core.*;
import org.xml.sax.SAXException;
import com.aetrion.flickr.people.*;
import com.aetrion.flickr.photos.*;
import com.aetrion.flickr.FlickrException;

String apiKey = "#####";
Flickr f;
ContactsInterface c;
PeopleInterface p;
PhotosInterface ph;
User u;

void setup() {
 size(1360, 768);
 background(255);
 
 f = new Flickr(apiKey);
 p = f.getPeopleInterface();
 
 getPhotos();
}

void draw() {
}

void getPhotos(){
 try {
   u = p.findByUsername("Augusto Esteves");
   PhotoList phLst = p.getPublicPhotos(u.getId(), 300, 0);  
   Iterator it = phLst.iterator();
   
   while(it.hasNext()) {
Photo photo = (Photo) it.next();
Collection coTags = photo.getTags();
println(photo.getTitle());
println(coTags);
   }
 } catch (IOException e) {
e.printStackTrace();
 } catch (SAXException e) {
e.printStackTrace();
 } catch (FlickrException e) {
e.printStackTrace();
 }
}


Anyone has a clue why I can get the photos' names, but I only get a [] for the tags?  Undecided
Re: Getting photos from Picasa, Flickr, etc
Reply #7 - Apr 27th, 2010, 2:37am
 
Got it working in a very weird way.

Code:
import com.aetrion.flickr.tags.*;
(...)
void getPhotos(){
try {
u = p.findByUsername("Augusto Esteves");
PhotoList phLst = p.getPublicPhotos(u.getId(), 300, 0);
Iterator it = phLst.iterator();

Photo photo = (Photo) it.next();
Photo tags = t.getListPhoto(photo.getId());
Collection ptags = tags.getTags();
(...)


I have to create a new photo that just holds the tags Shocked
Page Index Toggle Pages: 1