One-click photo with one click in PhoneGap

I am trying to click a photo and upload it after clicking the button. So can you take a picture and upload it with a single click?

function snap(){ // Take a picture using the devices camera and retrieve an image as a // base64-encoded string. navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50, destinationType: destinationType.DATA_URL }); } <button onclick="snap();">Snap</button> 
+4
source share
1 answer

If you just want to save a picture that doesn't matter whether the user selects it or not, set the saveToPhotoAlbum parameter in the getPicture method to true. Otherwise, if you want to upload the image to the server somewhere, you will need more work. Take a look at these articles that provide examples of how this is achieved:

-1
source

Source: https://habr.com/ru/post/1484460/


All Articles