Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Google image loader library

$
0
0

Hi there, I'm using a googleImageLoader library. I got my API key and it worked well. But I want to make user search images they want( The original code was set to find "sunset beach" ). so I changed some codes but they are really new for me that I can't find what is wrong. Is there anyone who can help me, please?

import at.mukprojects.imageloader.*;
import at.mukprojects.imageloader.google.*;
import at.mukprojects.imageloader.image.*;

String apiKey = "---------------  ";

ImageLoader loader;
ImageList list;
Image img;

String search = " ";

void setup() {
  size(800, 450);
  loader = new GoogleLoader(this, apiKey);
}

void draw() {

  textSize(64);
  fill(0);
  text(search, width/2, height/2); //show typing which image the user want to find

  if (mousePressed) {
    list = loader.start(search, true, 60 * 1000);
    img = list.getRandom();
    if (img == null) {
      img = list.getRandom();
    } else {
      image(img.getImg(), 0, 0, width, height);
    }
  }
}

void keyPressed() {
  search += key;
}

Viewing all articles
Browse latest Browse all 2896

Trending Articles