Reputation: 75
I am new in phonegap,I am making an app for android slide view using phonegap. I wants to capture images from camera then save these image files in to "assets/www/images" folder. Is there any way to do this task. Please help me. Thanks in advance.
Upvotes: 0
Views: 1191
Reputation: 6242
I am not sure on the requirements of your app, but you can take a picture using the Cordova Camera API and save the picture to the device's storage:
navigator.camera.getPicture(
function (uri) {
// img.src = uri;
},
function (e) {
// appropriate error handling
},
{
quality : 75,
destinationType : Camera.DestinationType.FILE_URI,
sourceType : Camera.PictureSourceType.CAMERA,
allowEdit : false,
encodingType: Camera.EncodingType.PNG,
saveToPhotoAlbum: false
}
);
If you need to take an arbitrary amount of photos, then in your success
function you could code some logic which creates an <img>
tag, and set the src to your uri returned parameter.
More info on the Cordova Camera API can be found here: http://cordova.apache.org/docs/en/3.3.0/cordova_camera_camera.md.html.
Upvotes: 0
Reputation: 1912
Ho Ajay,
welcome to phonegap.
No you cannot modify the content of the www
folder.
But you can store files (e.g. taken by camera) with the FileApi on the devices storage.
Using FileTransfer
you can even upload this image to your server (see here, the full example has even already the code for taking a picture included).
Keep in mind that you have to add both plugins (camera
and file
/ file-transfer
).
Have fun!
Upvotes: 2