@lodev09/react-native-exify 0.2.1 → 0.2.2
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
|
@@ -44,8 +44,9 @@ console.log(result.tags)
|
|
|
44
44
|
|
|
45
45
|
See [example](example) for more detailed usage.
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
ℹ️ Note that on IOS, writing exif into an Asset file will duplicate the image. IOS does not allow writing exif into an Asset file directly.
|
|
48
|
+
|
|
49
|
+
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!
|
|
49
50
|
|
|
50
51
|
## Contributing
|
|
51
52
|
Contributions are welcome!
|
package/ios/Exify.swift
CHANGED
|
@@ -71,10 +71,10 @@ class Exify: NSObject {
|
|
|
71
71
|
request.addResource(with: .photo, data: data, options: nil)
|
|
72
72
|
request.creationDate = Date()
|
|
73
73
|
|
|
74
|
-
let
|
|
74
|
+
let newAssetId = request.placeholderForCreatedAsset!.localIdentifier
|
|
75
75
|
resolve([
|
|
76
|
-
"uri": "ph://\(
|
|
77
|
-
"assetId":
|
|
76
|
+
"uri": "ph://\(newAssetId)",
|
|
77
|
+
"assetId": newAssetId,
|
|
78
78
|
"tags": getExifTags(from: metadata),
|
|
79
79
|
])
|
|
80
80
|
|
|
@@ -105,7 +105,6 @@ class Exify: NSObject {
|
|
|
105
105
|
|
|
106
106
|
resolve([
|
|
107
107
|
"uri": uri,
|
|
108
|
-
"assetId": nil,
|
|
109
108
|
"tags": getExifTags(from: metadata),
|
|
110
109
|
])
|
|
111
110
|
|
package/ios/ExifyUtils.swift
CHANGED
|
@@ -122,14 +122,14 @@ func updateMetadata(url: URL, with tags: [String: Any], completionHanlder: (NSDi
|
|
|
122
122
|
|
|
123
123
|
let destinationData = NSMutableData()
|
|
124
124
|
|
|
125
|
-
guard let
|
|
126
|
-
let sourceType = CGImageSourceGetType(cgImageSource),
|
|
125
|
+
guard let sourceType = CGImageSourceGetType(cgImageSource),
|
|
127
126
|
let destination = CGImageDestinationCreateWithData(destinationData, sourceType, 1, nil) else {
|
|
128
127
|
return
|
|
129
128
|
}
|
|
130
129
|
|
|
131
|
-
|
|
130
|
+
CGImageDestinationAddImageFromSource(destination, cgImageSource, 0, metadata)
|
|
132
131
|
if CGImageDestinationFinalize(destination) {
|
|
133
132
|
completionHanlder(metadata, destinationData as Data)
|
|
134
133
|
}
|
|
135
134
|
}
|
|
135
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* From Android's ExifInterface Tags
|
|
3
|
+
* Normalized for both IOS and Android
|
|
3
4
|
*/
|
|
4
5
|
export interface ExifTags {
|
|
5
6
|
SensorLeftBorder?: number;
|
|
@@ -146,15 +147,20 @@ export interface ExifTags {
|
|
|
146
147
|
export interface ExifyWriteResult {
|
|
147
148
|
/**
|
|
148
149
|
* The URI of the image that was written.
|
|
149
|
-
* On IOS asset, this will be new URI created.
|
|
150
|
+
* On IOS: If input URI is an asset, this will be new URI created.
|
|
151
|
+
*
|
|
152
|
+
* This will return exactly the same as the input URI if the input URI is from a local file.
|
|
150
153
|
*/
|
|
151
|
-
uri
|
|
154
|
+
uri: string;
|
|
152
155
|
/**
|
|
153
|
-
*
|
|
156
|
+
* A newly created asset ID on IOS.
|
|
157
|
+
* Writing exif metadata into an asset file will create a new asset file.
|
|
158
|
+
*
|
|
159
|
+
* @platform ios
|
|
154
160
|
*/
|
|
155
|
-
assetId?: string
|
|
161
|
+
assetId?: string;
|
|
156
162
|
/**
|
|
157
|
-
*
|
|
163
|
+
* Normalized Exif tags
|
|
158
164
|
*/
|
|
159
165
|
tags?: ExifTags;
|
|
160
166
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["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AE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lodev09/react-native-exify",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Read and write exif data into an image.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"workspaces": [
|
|
95
95
|
"example"
|
|
96
96
|
],
|
|
97
|
-
"packageManager": "yarn@
|
|
97
|
+
"packageManager": "yarn@4.1.1",
|
|
98
98
|
"jest": {
|
|
99
99
|
"preset": "react-native",
|
|
100
100
|
"modulePathIgnorePatterns": [
|
package/src/types.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* From Android's ExifInterface Tags
|
|
3
|
+
* Normalized for both IOS and Android
|
|
3
4
|
*/
|
|
4
5
|
export interface ExifTags {
|
|
5
6
|
SensorLeftBorder?: number
|
|
@@ -147,15 +148,20 @@ export interface ExifTags {
|
|
|
147
148
|
export interface ExifyWriteResult {
|
|
148
149
|
/**
|
|
149
150
|
* The URI of the image that was written.
|
|
150
|
-
* On IOS asset, this will be new URI created.
|
|
151
|
+
* On IOS: If input URI is an asset, this will be new URI created.
|
|
152
|
+
*
|
|
153
|
+
* This will return exactly the same as the input URI if the input URI is from a local file.
|
|
151
154
|
*/
|
|
152
|
-
uri
|
|
155
|
+
uri: string
|
|
153
156
|
/**
|
|
154
|
-
*
|
|
157
|
+
* A newly created asset ID on IOS.
|
|
158
|
+
* Writing exif metadata into an asset file will create a new asset file.
|
|
159
|
+
*
|
|
160
|
+
* @platform ios
|
|
155
161
|
*/
|
|
156
|
-
assetId?: string
|
|
162
|
+
assetId?: string
|
|
157
163
|
/**
|
|
158
|
-
*
|
|
164
|
+
* Normalized Exif tags
|
|
159
165
|
*/
|
|
160
166
|
tags?: ExifTags
|
|
161
167
|
}
|