Skip to content

Commit

Permalink
CB-11714: (windows) added extra check for content-type in savePhoto()…
Browse files Browse the repository at this point in the history
… without options.targetWidth/Height
  • Loading branch information
DisruptiveMind committed Dec 1, 2016
1 parent c9e6a9a commit a201722
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/windows/CameraProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,16 @@ function savePhoto(picture, options, successCallback, errorCallback) {
if (options.targetHeight > 0 && options.targetWidth > 0) {
resizeImage(successCallback, errorCallback, picture, options.targetWidth, options.targetHeight, options.encodingType);
} else {
picture.copyAsync(getAppData().localFolder, picture.name, OptUnique).done(function (copiedFile) {
successCallback("ms-appdata:///local/" + copiedFile.name);
},errorCallback);
// CB-11714: check if target content-type is PNG to just rename as *.jpg since camera is captured as JPEG
var pictureName = picture.name;

if (options.encodingType === Camera.EncodingType.PNG) {
pictureName = pictureName.replace(/\.png$/, ".jpg");
}

picture
.copyAsync(getAppData().localFolder, pictureName, OptUnique)
.done(function (copiedFile) { successCallback("ms-appdata:///local/" + copiedFile.name); }, errorCallback);
}
} else {
if (options.targetHeight > 0 && options.targetWidth > 0) {
Expand Down

0 comments on commit a201722

Please sign in to comment.