We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I want to write a sketch to open a random image from a folder.
I was able to do this in Processing by doing something like this:
String path="/somePath";
File dir = new File(path);
String[] list = dir.list();
int randomImage=random(0,list.length);
PImage pic;
pics=loadImage(path+list[randomImage]);
Do you have any ideas on how to do this in P5? Also, I don't seem to be able to use an absolute path, any thoughts?
Thank you!
Answers
Not sure, but I don't think that's possible! Maybe try out drop()?
http://p5js.org/reference/#/p5.Element/drop
https://forum.Processing.org/two/discussion/13650/dropped-image-not-showing-in-the-draw-loop-gotfile-createimg-image#Item_4
Or maybe createFileInput() instead?
http://p5js.org/reference/#/p5/createFileInput
http://p5js.org/reference/#/p5.File
https://forum.Processing.org/two/discussion/10092/p5-dom-createfileinput-problem-in-firefox