Skip to content

Commit 4614ad1

Browse files
authored
Merge pull request #91 from itsnyx/main
fix: android thumbnail typescript and kotlin code fix
2 parents 37b8974 + abc13f2 commit 4614ad1

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Fixed IsExportThumnail Missing And empty Thumbnail In Android Platform.
12
# React Native Multiple Image Picker (RNMIP)
23

34
<p align="center">

android/src/main/java/com/reactnativemultipleimagepicker/MultipleImagePickerModule.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ import com.luck.picture.lib.manager.UCropManager
2020
import com.luck.picture.lib.style.PictureParameterStyle
2121
import com.yalantis.ucrop.model.AspectRatio
2222
import com.yalantis.ucrop.view.CropImageView
23-
import java.io.File
24-
import java.io.FileOutputStream
25-
import java.io.IOException
26-
import java.io.OutputStream
23+
import java.io.*
2724
import java.util.*
2825

2926

@@ -268,15 +265,18 @@ class MultipleImagePickerModule(reactContext: ReactApplicationContext) :
268265
try {
269266
var fOut: OutputStream? = null
270267
val fileName = "thumb-" + UUID.randomUUID().toString() + ".jpeg"
271-
print("fileName $fileName")
272268
val file = File(fullPath, fileName)
269+
file.parentFile.mkdirs()
273270
file.createNewFile()
274-
fOut = FileOutputStream(file)
271+
try {
272+
val fos = FileOutputStream(file)
273+
image?.compress(Bitmap.CompressFormat.JPEG, 80, fos)
274+
fos.flush()
275+
fos.close()
275276

276-
// 100 means no compression, the lower you go, the stronger the compression
277-
image?.compress(Bitmap.CompressFormat.JPEG, 50, fOut)
278-
fOut.flush()
279-
fOut.close()
277+
} catch (e: FileNotFoundException) {
278+
e.printStackTrace()
279+
}
280280

281281
return "file://$fullPath/$fileName"
282282
} catch (e: Exception) {

src/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export type PickerErrorCode =
3838
export type Options<T extends MediaType = MediaType.ALL> = {
3939
mediaType?: T;
4040
isPreview?: boolean;
41+
isExportThumbnail?:boolean;
4142
selectedColor?: string;
4243
tapHereToChange?: string;
4344
cancelTitle?: string;

0 commit comments

Comments
 (0)