From 29cac79ee61f0351899d11743e4ce3840d716d99 Mon Sep 17 00:00:00 2001 From: yaw Date: Mon, 10 Dec 2018 13:55:05 +0800 Subject: [PATCH] add take photo api --- www/demo/demo.js | 8 ++++++++ www/demo/index.html | 1 + 2 files changed, 9 insertions(+) diff --git a/www/demo/demo.js b/www/demo/demo.js index ce5c35a..e49a87f 100644 --- a/www/demo/demo.js +++ b/www/demo/demo.js @@ -44,6 +44,14 @@ function compressImage() { } } +document.getElementById('takePhotoBtn').onclick = function() { + var cameraOptions={ quality: 25,mediaType: Camera.MediaType.PICTURE };//see cordova camera docs + MediaPicker.takePhoto(function(media) { + media.index=0;//index use to imgs[data.index].src; // media.index=resultMedias.length; + resultMedias.push(media); + getThumbnail(resultMedias); + }, function(e) { console.log(e) }, cameraOptions); +}; function loading() {} diff --git a/www/demo/index.html b/www/demo/index.html index a1a71bf..01520ee 100644 --- a/www/demo/index.html +++ b/www/demo/index.html @@ -48,6 +48,7 @@ +