mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-02-22 22:12:54 +08:00
add try ... catch for getting image orientation
There's bug in Windows Phone 8.1 causing Seek on a DssPhotoStream not working properly. https://connect.microsoft.com/VisualStudio/feedback/details/783252 But a mis-oriented file is better than nothing, so try and catch.
This commit is contained in:
parent
80b0048384
commit
d7e708db09
@ -271,10 +271,13 @@ namespace WPCordovaClassLib.Cordova.Commands
|
||||
Picture pict = library.SavePicture(e.OriginalFileName, e.ChosenPhoto); // to save to photo-roll ...
|
||||
}
|
||||
|
||||
int orient = ImageExifHelper.getImageOrientationFromStream(e.ChosenPhoto);
|
||||
int newAngle = 0;
|
||||
switch (orient)
|
||||
{
|
||||
// There's bug in Windows Phone 8.1 causing Seek on a DssPhotoStream not working properly.
|
||||
// https://connect.microsoft.com/VisualStudio/feedback/details/783252
|
||||
// But a mis-oriented file is better than nothing, so try and catch.
|
||||
try {
|
||||
int orient = ImageExifHelper.getImageOrientationFromStream(e.ChosenPhoto);
|
||||
switch (orient) {
|
||||
case ImageExifOrientation.LandscapeLeft:
|
||||
newAngle = 90;
|
||||
break;
|
||||
@ -287,6 +290,9 @@ namespace WPCordovaClassLib.Cordova.Commands
|
||||
case ImageExifOrientation.Portrait:
|
||||
default: break; // 0 default already set
|
||||
}
|
||||
} catch {
|
||||
Debug.WriteLine("Error fetching orientation from Exif");
|
||||
}
|
||||
|
||||
if (newAngle != 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user