diff --git a/app/build.gradle b/app/build.gradle index 595dffe9..51ec5ada 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.30.7' + compile 'com.simplemobiletools:commons:2.30.9' compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/PhotoProcessor.kt b/app/src/main/kotlin/com/simplemobiletools/camera/PhotoProcessor.kt index c50cef5f..40d171fd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/PhotoProcessor.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/PhotoProcessor.kt @@ -35,6 +35,13 @@ class PhotoProcessor(val activity: MainActivity, val uri: Uri?, val currCameraId } val data = params[0] + val tempFile = File.createTempFile("simple_temp_exif", "") + val tempFOS = FileOutputStream(tempFile) + tempFOS.use { + tempFOS.write(data) + } + val tempExif = ExifInterface(tempFile.absolutePath) + val photoFile = File(path) if (activity.needsStupidWritePermissions(path)) { if (activity.config.treeUri.isEmpty()) { @@ -87,7 +94,9 @@ class PhotoProcessor(val activity: MainActivity, val uri: Uri?, val currCameraId if (path.startsWith(activity.internalStoragePath)) { exifOrientation = getExifOrientation(totalRotation) } + tempExif.copyTo(fileExif) fileExif.setAttribute(ExifInterface.TAG_ORIENTATION, exifOrientation) + fileExif.saveAttributes() return photoFile.absolutePath } catch (e: Exception) {