mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-01-19 03:35:10 +08:00
CB-11714: (windows) added extra check for content-type in savePhoto() without options.targetWidth/Height
This commit is contained in:
parent
c9e6a9a38a
commit
a201722f6d
@ -800,9 +800,16 @@ function savePhoto(picture, options, successCallback, errorCallback) {
|
|||||||
if (options.targetHeight > 0 && options.targetWidth > 0) {
|
if (options.targetHeight > 0 && options.targetWidth > 0) {
|
||||||
resizeImage(successCallback, errorCallback, picture, options.targetWidth, options.targetHeight, options.encodingType);
|
resizeImage(successCallback, errorCallback, picture, options.targetWidth, options.targetHeight, options.encodingType);
|
||||||
} else {
|
} else {
|
||||||
picture.copyAsync(getAppData().localFolder, picture.name, OptUnique).done(function (copiedFile) {
|
// CB-11714: check if target content-type is PNG to just rename as *.jpg since camera is captured as JPEG
|
||||||
successCallback("ms-appdata:///local/" + copiedFile.name);
|
var pictureName = picture.name;
|
||||||
},errorCallback);
|
|
||||||
|
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 {
|
} else {
|
||||||
if (options.targetHeight > 0 && options.targetWidth > 0) {
|
if (options.targetHeight > 0 && options.targetWidth > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user