I know the Camera plugin gives access to select a photo from the camera roll but I need the app to select a random photo - not sure if this is possible.
I'd need this to work in iOS and Android.
I know the Camera plugin gives access to select a photo from the camera roll but I need the app to select a random photo - not sure if this is possible.
I'd need this to work in iOS and Android.
I am still confused about your requirement but I will just try to answer. My answer is with respect to Objective-c; same can be extended to android.
Since you said that you have access to camera roll, take all the names of the files and put them into NSArray
. Suppose total number of photos are N
. Use any randomise method (like arc4random_uniform(N)
) to get a random number between 0 and N. Use that number as index of your NSArray
and upload the photo whose name is there at that index.
UPDATE: To get filenames using phonegap you can check out this link. It is about svg files, you can do the same for your image format(png, jpeg etc)