You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2013/05/03 00:45:56 UTC
spec commit: [CB-2909] Camera manual test for DATA_URL does not show
the preview image
Updated Branches:
refs/heads/master 001e5d1a9 -> d8cfbf888
[CB-2909] Camera manual test for DATA_URL does not show the preview image
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/d8cfbf88
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/d8cfbf88
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/d8cfbf88
Branch: refs/heads/master
Commit: d8cfbf888a855be88447cbcf5934563718f46da5
Parents: 001e5d1
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu May 2 15:45:56 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu May 2 15:45:56 2013 -0700
----------------------------------------------------------------------
camera/index.html | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/d8cfbf88/camera/index.html
----------------------------------------------------------------------
diff --git a/camera/index.html b/camera/index.html
index 8ea6ee8..b3ea47e 100644
--- a/camera/index.html
+++ b/camera/index.html
@@ -71,8 +71,16 @@
}
function setPicture(url, callback) {
+ try {
+ window.atob(url);
+ // if we got here it is a base64 string (DATA_URL)
+ url = "data:image/jpeg;base64," + url;
+ } catch (e) {
+ // not DATA_URL
+ log('URL: ' + url.slice(0, 100));
+ }
+
pictureUrl = url;
- log('URL: ' + url.slice(0, 100));
var img = document.getElementById('camera_image');
var startTime = new Date();
img.src = url;
@@ -94,6 +102,8 @@
fileEntry = e;
logCallback('resolveLocalFileSystemURI()', true)(e);
}, logCallback('resolveLocalFileSystemURI()', false));
+ } else if (pictureUrl.indexOf('data:image/jpeg;base64' == 0)) {
+ // do nothing
} else {
var path = pictureUrl.replace(/^file:\/\/(localhost)?/, '').replace(/%20/g, ' ');
fileEntry = new FileEntry('image_name.png', path);