mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-01-18 19:22:51 +08:00
fix(browser): Make data uri be returned as actual URI strings (#912)
This commit is contained in:
parent
2eaa9a3972
commit
53795454f4
@ -39,7 +39,7 @@ function takePicture (success, error, opts) {
|
|||||||
|
|
||||||
const imageData = readerEvent.target.result;
|
const imageData = readerEvent.target.result;
|
||||||
|
|
||||||
return success(imageData.substr(imageData.indexOf(',') + 1));
|
return success(imageData);
|
||||||
};
|
};
|
||||||
|
|
||||||
reader.readAsDataURL(inputEvent.target.files[0]);
|
reader.readAsDataURL(inputEvent.target.files[0]);
|
||||||
@ -78,8 +78,7 @@ function capture (success, errorCallback, opts) {
|
|||||||
canvas.getContext('2d').drawImage(video, 0, 0, targetWidth, targetHeight);
|
canvas.getContext('2d').drawImage(video, 0, 0, targetWidth, targetHeight);
|
||||||
|
|
||||||
// convert image stored in canvas to base64 encoded image
|
// convert image stored in canvas to base64 encoded image
|
||||||
let imageData = canvas.toDataURL('image/png');
|
const imageData = canvas.toDataURL('image/png');
|
||||||
imageData = imageData.replace('data:image/png;base64,', '');
|
|
||||||
|
|
||||||
// stop video stream, remove video and button.
|
// stop video stream, remove video and button.
|
||||||
// Note that MediaStream.stop() is deprecated as of Chrome 47.
|
// Note that MediaStream.stop() is deprecated as of Chrome 47.
|
||||||
|
Loading…
Reference in New Issue
Block a user