PImage b; String currentWidth; String currentHeight; String currentImage; int diffW; int diffH; int imageW; int imageH; int setX; int setY; void setup() { background(0); size(1024,768); } void draw() { background(0); getLinks("i","$","#"); getLinks("w","%","@"); getLinks("h","*","+"); println("currentImage " + currentImage); println("currentWidth " + currentWidth); println("currentHeight " + currentHeight); b = loadImage(currentImage); imageW = int(currentWidth); imageH = int(currentHeight); setX = (width - imageW)/2; setY = (height - imageH)/2; image(b,setX,setY,imageW,imageH); //image(b, (width-int(currentWidth))/2,(height-int(currentHeight))/2,width,height); // println("timer"); delay(10000); // Stops the program for 250 milliseconds } void getLinks(String _get, String _lookFor, String _end) { String url = "http://www.susanbuck.net/photoFrame/index.asp"; // RSS FEED TO LOOK AT, SHOWS MY TEN MOST RECENT BOOKMARKS String[] lines = loadStrings(url); // LOAD THAT URL String rss = join(lines, " "); // COMBINE RSS FEED INTO ONE STRING String lookFor = _lookFor; // BEGINNING TAG OF A LINK String end = _end; // END TAG OF A LINK // VARIABLES int lookPastThisPoint = 0; // "CURSOR" OF WHERE IN THE STRING WE'RE LOOKING (SO WE CAN MOVE ALONG THROUGH THE STRING). int startPoint; // WHERE SUBSTRING WILL START int endPoint; // WHERE SUBSTRING WILL END //String[] tenLinks = new String[10]; // ARRAY TO HOLD 10 LINKS // LOOP 10 TIMES startPoint = rss.indexOf(lookFor,lookPastThisPoint); // GET STARTING POINT BY FINDING THE INDEX OF WHERE START STRING BEGINS // THE indexOf FUNCTION CAN BE GIVEN A SECOND VALUE TELLING IT WHERE TO START - // SINCE WE NEED TO PROGRESS THROUGH THE STRING, THE VAR lookPastThisPoint ACTS AS A CURSOR // SO THAT EACH TIME THROUGH THE LOOP WE ONLY LOOK FORWARD FROM THAT CURSOR startPoint += lookFor.length(); // move to the end // LAST LINE GAVE THE START OF THE STRING, BUT NEED TO MOVE TO THE END OF THAT STRING endPoint = rss.indexOf(end,lookPastThisPoint); // GET END POINT, AGAIN ONLY LOOKING PAST WHERE OUR CURSOR IS if (_get == "i") { currentImage = rss.substring(startPoint,endPoint); // PUT WHATEVER FALLS BETWEEN OUR startPoint AND endPoint into the array } if (_get == "w") { currentWidth = rss.substring(startPoint,endPoint); // PUT WHATEVER FALLS BETWEEN OUR startPoint AND endPoint into the array } if (_get == "h") { currentHeight = rss.substring(startPoint,endPoint); // PUT WHATEVER FALLS BETWEEN OUR startPoint AND endPoint into the array } // println(_get); //lookPastThisPoint = endPoint + 2; // END POINT IS LOOKING AT THE "/" IN OUR END STRING "/>" SO MOVE THE CURSOR OVER 2 }