mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-01-18 19:22:51 +08:00
Merge pull request #242 from DisruptiveMind/master
CB-11714: (windows) added check for encoding in savePhoto() without height/width
This commit is contained in:
commit
dc73954108
@ -785,6 +785,11 @@ 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 {
|
||||||
|
// CB-11714: check if target content-type is PNG to just rename as *.jpg since camera is captured as JPEG
|
||||||
|
if (options.encodingType === Camera.EncodingType.PNG) {
|
||||||
|
picture.name = picture.name.replace(/\.png$/, '.jpg');
|
||||||
|
}
|
||||||
|
|
||||||
picture.copyAsync(getAppData().localFolder, picture.name, OptUnique).done(function (copiedFile) {
|
picture.copyAsync(getAppData().localFolder, picture.name, OptUnique).done(function (copiedFile) {
|
||||||
successCallback('ms-appdata:///local/' + copiedFile.name);
|
successCallback('ms-appdata:///local/' + copiedFile.name);
|
||||||
}, errorCallback);
|
}, errorCallback);
|
||||||
|
Loading…
Reference in New Issue
Block a user