mirror of
				https://github.com/SimpleMobileTools/Simple-Camera.git
				synced 2025-06-27 09:02:59 +02:00 
			
		
		
		
	attach exif data to images whenever possible
This commit is contained in:
		| @@ -37,7 +37,7 @@ android { | |||||||
| } | } | ||||||
|  |  | ||||||
| dependencies { | dependencies { | ||||||
|     compile 'com.simplemobiletools:commons:2.30.7' |     compile 'com.simplemobiletools:commons:2.30.9' | ||||||
|     compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" |     compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -35,6 +35,13 @@ class PhotoProcessor(val activity: MainActivity, val uri: Uri?, val currCameraId | |||||||
|             } |             } | ||||||
|  |  | ||||||
|             val data = params[0] |             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) |             val photoFile = File(path) | ||||||
|             if (activity.needsStupidWritePermissions(path)) { |             if (activity.needsStupidWritePermissions(path)) { | ||||||
|                 if (activity.config.treeUri.isEmpty()) { |                 if (activity.config.treeUri.isEmpty()) { | ||||||
| @@ -87,7 +94,9 @@ class PhotoProcessor(val activity: MainActivity, val uri: Uri?, val currCameraId | |||||||
|             if (path.startsWith(activity.internalStoragePath)) { |             if (path.startsWith(activity.internalStoragePath)) { | ||||||
|                 exifOrientation = getExifOrientation(totalRotation) |                 exifOrientation = getExifOrientation(totalRotation) | ||||||
|             } |             } | ||||||
|  |             tempExif.copyTo(fileExif) | ||||||
|             fileExif.setAttribute(ExifInterface.TAG_ORIENTATION, exifOrientation) |             fileExif.setAttribute(ExifInterface.TAG_ORIENTATION, exifOrientation) | ||||||
|  |  | ||||||
|             fileExif.saveAttributes() |             fileExif.saveAttributes() | ||||||
|             return photoFile.absolutePath |             return photoFile.absolutePath | ||||||
|         } catch (e: Exception) { |         } catch (e: Exception) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user