janpio closed pull request #311: CB-13836 Windows phone correct filename
URL: https://github.com/apache/cordova-plugin-camera/pull/311
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/src/windows/CameraProxy.js b/src/windows/CameraProxy.js
index e20d28d6..4325b800 100644
--- a/src/windows/CameraProxy.js
+++ b/src/windows/CameraProxy.js
@@ -833,12 +833,16 @@ function savePhoto (picture, options, successCallback,
errorCallback) {
};
savePicker.suggestedStartLocation = pickerLocId.picturesLibrary;
+ var date = new Date();
+ var isoDate = new Date(date.getTime() - (date.getTimezoneOffset() *
60000)).toISOString();
+ var fileName = 'IMG_' + isoDate.replace(/T/g, '_').replace(/[^\d^_]/g,
'');
+
if (options.encodingType === Camera.EncodingType.PNG) {
savePicker.fileTypeChoices.insert('PNG', ['.png']);
- savePicker.suggestedFileName = 'photo.png';
+ savePicker.suggestedFileName = fileName + '.png';
} else {
savePicker.fileTypeChoices.insert('JPEG', ['.jpg']);
- savePicker.suggestedFileName = 'photo.jpg';
+ savePicker.suggestedFileName = fileName + '.jpg';
}
// If Windows Phone 8.1 use pickSaveFileAndContinue()
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]