Skip to content

Commit

Permalink
[CB-2909] Camera manual test for DATA_URL does not show the preview i…
Browse files Browse the repository at this point in the history
…mage
  • Loading branch information
shazron committed May 2, 2013
1 parent 001e5d1 commit d8cfbf8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion camera/index.html
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit d8cfbf8

Please sign in to comment.