set the photo exif a bit later after saving

This commit is contained in:
tibbi 2017-09-23 16:54:39 +02:00
parent 84d4c1f779
commit 3cac30436d
1 changed files with 7 additions and 9 deletions

View File

@ -66,11 +66,7 @@ class PhotoProcessor(val activity: MainActivity, val uri: Uri?, val currCameraId
}
val totalRotation = (imageRot + deviceRot + previewRot) % 360
val fileExif = ExifInterface(path)
var exifOrientation = ExifInterface.ORIENTATION_NORMAL.toString()
if (path.startsWith(activity.internalStoragePath)) {
exifOrientation = getExifOrientation(totalRotation)
} else {
if (!path.startsWith(activity.internalStoragePath)) {
image = rotate(image, totalRotation)
}
@ -84,11 +80,13 @@ class PhotoProcessor(val activity: MainActivity, val uri: Uri?, val currCameraId
image = Bitmap.createBitmap(image, 0, 0, image.width, image.height, matrix, false)
}
if (image != null) {
image.compress(Bitmap.CompressFormat.JPEG, 80, fos)
fos?.close()
}
val fileExif = ExifInterface(path)
var exifOrientation = ExifInterface.ORIENTATION_NORMAL.toString()
if (path.startsWith(activity.internalStoragePath)) {
exifOrientation = getExifOrientation(totalRotation)
}
fileExif.setAttribute(ExifInterface.TAG_ORIENTATION, exifOrientation)
fileExif.saveAttributes()
return photoFile.absolutePath