This is an automated email from the ASF dual-hosted git repository.

normanbreau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-camera.git


The following commit(s) were added to refs/heads/master by this push:
     new 5379545  fix(browser): Make data uri be returned as actual URI strings 
(#912)
5379545 is described below

commit 53795454f4b21e1c21a91305d4b617cc32a91c54
Author: Norman Breau <nor...@breautek.com>
AuthorDate: Sun Oct 27 08:32:14 2024 -0300

    fix(browser): Make data uri be returned as actual URI strings (#912)
---
 src/browser/CameraProxy.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/browser/CameraProxy.js b/src/browser/CameraProxy.js
index 104c64f..cb4eb28 100644
--- a/src/browser/CameraProxy.js
+++ b/src/browser/CameraProxy.js
@@ -39,7 +39,7 @@ function takePicture (success, error, opts) {
 
                 const imageData = readerEvent.target.result;
 
-                return success(imageData.substr(imageData.indexOf(',') + 1));
+                return success(imageData);
             };
 
             reader.readAsDataURL(inputEvent.target.files[0]);
@@ -78,8 +78,7 @@ function capture (success, errorCallback, opts) {
         canvas.getContext('2d').drawImage(video, 0, 0, targetWidth, 
targetHeight);
 
         // convert image stored in canvas to base64 encoded image
-        let imageData = canvas.toDataURL('image/png');
-        imageData = imageData.replace('data:image/png;base64,', '');
+        const imageData = canvas.toDataURL('image/png');
 
         // stop video stream, remove video and button.
         // Note that MediaStream.stop() is deprecated as of Chrome 47.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to