Fix crash when taking picture to send with chat on some devices/android

This commit is contained in:
Sylvain Berfini 2012-12-17 15:51:08 +01:00
parent 7000bc4b3d
commit 9788e09ff8

View file

@ -748,17 +748,19 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
// Rotate the bitmap if possible/needed, using EXIF data
try {
ExifInterface exif = new ExifInterface(filePath);
int pictureOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0);
Matrix matrix = new Matrix();
if (pictureOrientation == 6) {
matrix.postRotate(90);
} else if (pictureOrientation == 3) {
matrix.postRotate(180);
} else if (pictureOrientation == 8) {
matrix.postRotate(270);
if (filePath != null) {
ExifInterface exif = new ExifInterface(filePath);
int pictureOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0);
Matrix matrix = new Matrix();
if (pictureOrientation == 6) {
matrix.postRotate(90);
} else if (pictureOrientation == 3) {
matrix.postRotate(180);
} else if (pictureOrientation == 8) {
matrix.postRotate(270);
}
bm = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true);
}
bm = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true);
} catch (Exception e) {
e.printStackTrace();
}