Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9A4DA18CF3 for ; Sat, 17 Oct 2015 12:18:05 +0000 (UTC) Received: (qmail 92846 invoked by uid 500); 17 Oct 2015 12:18:05 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 92819 invoked by uid 500); 17 Oct 2015 12:18:05 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 92708 invoked by uid 99); 17 Oct 2015 12:18:05 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Oct 2015 12:18:05 +0000 Date: Sat, 17 Oct 2015 12:18:05 +0000 (UTC) From: "Remco Haszing (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (CB-9819) navigator.camera.getPicture returns a base64 string, not a data url. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Remco Haszing created CB-9819: --------------------------------- Summary: navigator.camera.getPicture returns a base64 string, not a data url. Key: CB-9819 URL: https://issues.apache.org/jira/browse/CB-9819 Project: Apache Cordova Issue Type: Bug Components: Plugin Camera Reporter: Remco Haszing Priority: Minor When calling {{navigator.camera.getPicture}} with {{destinationType}} set to {{Camera.DestinationType.DATA_URL}}, the success function is called with the base64 encoded data. [RFC2397|http://tools.ietf.org/html/rfc2397] specified the data url should have the following format: {code}data:[][;base64],{code} I would expect the data to be passed in this format, when a {{DATA_URL}} format is requested. The example in the README handles this _"bug"_ {code:javascript} navigator.camera.getPicture(onSuccess, onFail, { quality: 50, destinationType: Camera.DestinationType.DATA_URL }); function onSuccess(imageData) { var image = document.getElementById('myImage'); image.src = "data:image/jpeg;base64," + imageData; } function onFail(message) { alert('Failed because: ' + message); } {code} Instead I suggest the following options: * base64 encoded: {code:javascript} navigator.camera.getPicture(onSuccess, onFail, { quality: 50, destinationType: Camera.DestinationType.BASE64_ENCODED }); function onSuccess(imageData) { var image = document.getElementById('myImage'); image.src = "data:image/jpeg;base64," + imageData; } function onFail(message) { alert('Failed because: ' + message); } {code} * data url: {code:javascript} navigator.camera.getPicture(onSuccess, onFail, { quality: 50, destinationType: Camera.DestinationType.DATA_URL }); function onSuccess(imageData) { var image = document.getElementById('myImage'); image.src = imageData; } function onFail(message) { alert('Failed because: ' + message); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org