Different devices will store saved photographs in different locations, typically in either a photo library or a saved photo album. The camera plugin API gives developers the ability to select or specify from which location an image should be retrieved.
We must use the getPicture
method, available from the Camera
object, to either select an image from the device library, or capture a new image directly from the camera:
Firstly, create a new PhoneGap project named
cameraroll
by running this command:phonegap create cameraroll com.myapp.cameraroll cameraroll
Add the devices platform. You can choose to use Android, iOS, or both:
cordova platform add ios cordova platform add android
Add the
media
andfile-transfer
plugins by running the following commands:cordova plugin add cordova-plugin-media cordova plugin add cordova-plugin-file-transfer
Open
www/index.html
. Let's clean up the unnecessary elements. We will use jQuery Mobile...