cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an-s...@apache.org
Subject cordova-plugin-camera git commit: CB-11714: (windows) added more explicit content-type when converting to target data on canvas
Date Thu, 25 Aug 2016 07:02:32 GMT
Repository: cordova-plugin-camera
Updated Branches:
  refs/heads/master b89645c74 -> c98607c61


CB-11714: (windows) added more explicit content-type when converting to target data on canvas

 This closes #232


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/c98607c6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/c98607c6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/c98607c6

Branch: refs/heads/master
Commit: c98607c613602a0ae2d0f1004af27732227244ee
Parents: b89645c
Author: Tyler Pham <tyler@disruptiveart.com>
Authored: Sun Aug 21 17:50:35 2016 -0400
Committer: Vladimir Kotikov <kotikov.vladimir@gmail.com>
Committed: Thu Aug 25 10:00:41 2016 +0300

----------------------------------------------------------------------
 src/windows/CameraProxy.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/c98607c6/src/windows/CameraProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/CameraProxy.js b/src/windows/CameraProxy.js
index 0862f35..eb10cd2 100644
--- a/src/windows/CameraProxy.js
+++ b/src/windows/CameraProxy.js
@@ -79,10 +79,14 @@ var HIGHEST_POSSIBLE_Z_INDEX = 2147483647;
 // Resize method
 function resizeImage(successCallback, errorCallback, file, targetWidth, targetHeight, encodingType)
{
     var tempPhotoFileName = "";
+    var targetContentType = "";
+
     if (encodingType == Camera.EncodingType.PNG) {
         tempPhotoFileName = "camera_cordova_temp_return.png";
+        targetContentType = "image/png";
     } else {
         tempPhotoFileName = "camera_cordova_temp_return.jpg";
+        targetContentType = "image/jpeg";
     }
 
     var storageFolder = getAppData().localFolder;
@@ -108,7 +112,7 @@ function resizeImage(successCallback, errorCallback, file, targetWidth,
targetHe
 
                 canvas.getContext("2d").drawImage(this, 0, 0, imageWidth, imageHeight);
 
-                var fileContent = canvas.toDataURL(file.contentType).split(',')[1];
+                var fileContent = canvas.toDataURL(targetContentType).split(',')[1];
 
                 var storageFolder = getAppData().localFolder;
 
@@ -745,7 +749,7 @@ function takePictureFromCameraWindows(successCallback, errorCallback,
args) {
     cameraCaptureUI.photoSettings.maxResolution = maxRes;
 
     var cameraPicture;
-    
+
     // define focus handler for windows phone 10.0
     var savePhotoOnFocus = function () {
         window.removeEventListener("focus", savePhotoOnFocus);
@@ -760,7 +764,7 @@ function takePictureFromCameraWindows(successCallback, errorCallback,
args) {
     };
 
     // if windows phone 10, add and delete focus eventHandler to capture the focus back from
cameraUI to app
-    if (navigator.appVersion.indexOf('Windows Phone 10.0') >= 0) { 
+    if (navigator.appVersion.indexOf('Windows Phone 10.0') >= 0) {
         window.addEventListener("focus", savePhotoOnFocus);
     }
 


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


Mime
View raw message