expo-image-picker 16.0.0 → 16.0.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/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 16.0.2 — 2024-11-14
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
17
|
+
## 16.0.1 — 2024-11-04
|
|
18
|
+
|
|
19
|
+
### 🐛 Bug fixes
|
|
20
|
+
|
|
21
|
+
- Fix incorrect width/height reported with EXIF tags 5 and 7 ([#32534](https://github.com/expo/expo/pull/32534) by [@gaearon](https://github.com/gaearon))
|
|
22
|
+
|
|
13
23
|
## 16.0.0 — 2024-10-22
|
|
14
24
|
|
|
15
25
|
### 🛠 Breaking changes
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
|
|
3
3
|
group = 'host.exp.exponent'
|
|
4
|
-
version = '16.0.
|
|
4
|
+
version = '16.0.2'
|
|
5
5
|
|
|
6
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
7
|
apply from: expoModulesCorePlugin
|
|
@@ -14,7 +14,11 @@ android {
|
|
|
14
14
|
namespace "expo.modules.imagepicker"
|
|
15
15
|
defaultConfig {
|
|
16
16
|
versionCode 22
|
|
17
|
-
versionName "16.0.
|
|
17
|
+
versionName "16.0.2"
|
|
18
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
19
|
+
}
|
|
20
|
+
testOptions {
|
|
21
|
+
unitTests.includeAndroidResources = true
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
24
|
|
|
@@ -25,4 +29,8 @@ dependencies {
|
|
|
25
29
|
implementation "com.github.CanHub:Android-Image-Cropper:4.3.1"
|
|
26
30
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.3"
|
|
27
31
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3"
|
|
32
|
+
|
|
33
|
+
if (project.findProject(':expo-modules-test-core')) {
|
|
34
|
+
androidTestImplementation project(':expo-modules-test-core')
|
|
35
|
+
}
|
|
28
36
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
package expo.modules.imagepicker.exporters
|
|
2
|
+
|
|
3
|
+
import android.graphics.BitmapFactory
|
|
4
|
+
import androidx.exifinterface.media.ExifInterface
|
|
5
|
+
import java.io.File
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Image will be rotated to orientation suggested by the exif data, because of that the width and height
|
|
9
|
+
* returned by the picker should be switched if the image is rotated 90 or 270 degrees.
|
|
10
|
+
*/
|
|
11
|
+
class DimensionsExporter(private val file: File) {
|
|
12
|
+
private val isRotatedLandscape by lazy {
|
|
13
|
+
val exifInterface = ExifInterface(file.absolutePath)
|
|
14
|
+
val imageRotation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0)
|
|
15
|
+
return@lazy (
|
|
16
|
+
imageRotation == ExifInterface.ORIENTATION_ROTATE_90 ||
|
|
17
|
+
imageRotation == ExifInterface.ORIENTATION_ROTATE_270 ||
|
|
18
|
+
imageRotation == ExifInterface.ORIENTATION_TRANSPOSE ||
|
|
19
|
+
imageRotation == ExifInterface.ORIENTATION_TRANSVERSE
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private val metadata by lazy {
|
|
24
|
+
val options = BitmapFactory.Options().apply { inJustDecodeBounds = true }
|
|
25
|
+
BitmapFactory.decodeFile(file.absolutePath, options)
|
|
26
|
+
options
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
val width: Int
|
|
30
|
+
get() = if (isRotatedLandscape) metadata.outHeight else metadata.outWidth
|
|
31
|
+
|
|
32
|
+
val height
|
|
33
|
+
get() = if (isRotatedLandscape) metadata.outWidth else metadata.outHeight
|
|
34
|
+
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
package expo.modules.imagepicker.exporters
|
|
2
2
|
|
|
3
3
|
import android.content.ContentResolver
|
|
4
|
-
import android.graphics.BitmapFactory
|
|
5
|
-
import android.media.ExifInterface
|
|
6
4
|
import android.net.Uri
|
|
7
5
|
import expo.modules.imagepicker.copyFile
|
|
8
6
|
import java.io.File
|
|
@@ -14,21 +12,11 @@ class RawImageExporter : ImageExporter {
|
|
|
14
12
|
contentResolver: ContentResolver
|
|
15
13
|
): ImageExportResult {
|
|
16
14
|
copyFile(source, output, contentResolver)
|
|
17
|
-
val
|
|
18
|
-
val imageRotation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0)
|
|
19
|
-
val isRotatedLandscape = (imageRotation == ExifInterface.ORIENTATION_ROTATE_90 || imageRotation == ExifInterface.ORIENTATION_ROTATE_270)
|
|
20
|
-
val options = BitmapFactory.Options().apply { inJustDecodeBounds = true }
|
|
21
|
-
|
|
22
|
-
BitmapFactory.decodeFile(output.absolutePath, options)
|
|
23
|
-
|
|
24
|
-
// Image will be rotated to orientation suggested by the exif data, because of that the width and height
|
|
25
|
-
// returned by the picker should be switched if the image is rotated 90 or 270 degrees.
|
|
26
|
-
val width: Int = if (isRotatedLandscape) options.outHeight else options.outWidth
|
|
27
|
-
val height: Int = if (isRotatedLandscape) options.outWidth else options.outHeight
|
|
15
|
+
val dimensionsExporter = DimensionsExporter(output)
|
|
28
16
|
|
|
29
17
|
return ImageExportResult(
|
|
30
|
-
width,
|
|
31
|
-
height,
|
|
18
|
+
dimensionsExporter.width,
|
|
19
|
+
dimensionsExporter.height,
|
|
32
20
|
output
|
|
33
21
|
)
|
|
34
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-image-picker",
|
|
3
|
-
"version": "16.0.
|
|
3
|
+
"version": "16.0.2",
|
|
4
4
|
"description": "Provides access to the system's UI for selecting images and videos from the phone's library or taking a photo with the camera.",
|
|
5
5
|
"main": "build/ImagePicker.js",
|
|
6
6
|
"types": "build/ImagePicker.d.ts",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"expo": "*"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "b7b95a93855cb4863b626c4524fc6e8b3a2305eb"
|
|
48
48
|
}
|