@lodev09/react-native-exify 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ const result = await writeAsync(uri, newTags)
|
|
|
46
46
|
console.log(result.tags)
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
>
|
|
49
|
+
> [!NOTE]
|
|
50
50
|
> On IOS, writing exif into an Asset file will duplicate the image. IOS does not allow writing exif into an Asset file directly.
|
|
51
51
|
> If you're getting the photo from a [camera](https://github.com/mrousavy/react-native-vision-camera/), write it into the output file first before saving to the Asset library!
|
|
52
52
|
|
|
@@ -51,14 +51,18 @@ class ExifyModule(reactContext: ReactApplicationContext) :
|
|
|
51
51
|
context.contentResolver.openFileDescriptor(photoUri, "rw", null)?.use { parcelDescriptor ->
|
|
52
52
|
val exif = ExifInterface(parcelDescriptor.fileDescriptor)
|
|
53
53
|
|
|
54
|
-
for ((
|
|
54
|
+
for ((valType, tag) in EXIFY_TAGS) {
|
|
55
55
|
if (!tags.hasKey(tag)) continue
|
|
56
56
|
|
|
57
57
|
val type = tags.getType(tag)
|
|
58
58
|
|
|
59
59
|
when (type) {
|
|
60
60
|
ReadableType.Boolean -> exif.setAttribute(tag, tags.getBoolean(tag).toString())
|
|
61
|
-
ReadableType.Number ->
|
|
61
|
+
ReadableType.Number ->
|
|
62
|
+
when (valType) {
|
|
63
|
+
"double" -> exif.setAttribute(tag, tags.getDouble(tag).toBigDecimal().toPlainString())
|
|
64
|
+
else -> exif.setAttribute(tag, tags.getDouble(tag).toInt().toString())
|
|
65
|
+
}
|
|
62
66
|
ReadableType.String -> exif.setAttribute(tag, tags.getString(tag))
|
|
63
67
|
ReadableType.Array -> exif.setAttribute(tag, tags.getArray(tag).toString())
|
|
64
68
|
else -> exif.setAttribute(tag, tags.getString(tag))
|