I am trying to load images from instragram that are posted on twitter. I have so far been able to load up an image and draw this on the sketch however what I really need to do is put these images into an array and loop through them and draw them. I am having trouble as I can get the sketch to draw the same image numerous times or I can get it to draw a number of different images but all at the same time rather than drawing one, then moving on to the next. I'm not a code monkey but i do know a little bit so bare with me, would really appreciate some help with this!
Here is my code thus far:
String msg; // variable for tweet
String isa; // variable for isa.
String ss2; // variable for ss2.
int p3;
int p4;
int r;
float f;
int x;
ArrayList tweets;
PImage images[] = new PImage[3]; // image array list
void setup () {
//Set the size of the stage, and the background to black and frame rate.
size (1000,1000);
background(0);
smooth();
frameRate(1);
//Credentials
ConfigurationBuilder cb = new ConfigurationBuilder();
Twitter twitter = new TwitterFactory(cb.build()).getInstance();
Query query = new Query ("instagr.am/p/"); // queries twitter for - instagr.am/p/
query.setRpp(3); //how many results to return.
//Try making the query request.
try {
QueryResult result = twitter.search(query);
tweets = (ArrayList) result.getTweets();
for (int i = 0; i < tweets.size(); i++) {
Tweet t = (Tweet) tweets.get(i); // gets the tweet
String msg = t.getText(); // puts the tweet into the String variable msg
int p1 = msg.indexOf("http://t.co/"); // For some reason which I do no know, when the tweets are put into processiong, the instrgram links are shortened to something different.
int p2 = p1 + 20; // each link is a set amount of characters long, so by adding 20 to p2 you include the extention of the link.
String ss1 = msg.substring(p1, p2); // ssl has the value of p1 + p2
// Load URL and print all lines of file to console/underneath thingy magigy
String lines[] = loadStrings (ss1);
for (int pq=0; pq < lines.length; pq++) {
isa = lines[pq]; // puts contents of pq into String str.
p3 = isa.indexOf("meta property=\"og:image\""); // finds first occuring position of "class Image" and puts the position of text into variable p3
p4 = isa.indexOf(".jpg");
if (p3 >=1){
ss2 = isa.substring(p3 + 34, p4 + 4); // ssl has the value of p1 + p2
println(ss2); // prints console/underneath thingy magigy