React-native-image-crop-picker: unable to get filename of an image in android

Created on 25 Jul 2019  路  6Comments  路  Source: ivpusic/react-native-image-crop-picker

Version

Tell us which versions you are using:

  • react-native-image-crop-picker ^0.25.0
  • react-native ^0.60.4

Platform

Tell us to which platform this issue is related

  • Android

Expected behaviour

file:///storage/emulated/0/Android/data/com.techo2/cache/photo-2009714323

Actual behaviour

file:///storage/emulated/0/Android/data/com.techo2/cache/undefined

Steps to reproduce

  1. please help me

Attachments

// stacktrace or any other useful debug info

Love react-native-image-crop-picker? Please consider supporting our collective:
馃憠 https://opencollective.com/react-native-image-crop-picker/donate

Most helpful comment

It is working fine for me.

I used filnename= path.substring(item.path.lastIndexOf('/') + 1), to get the selected image name from its path

All 6 comments

Same here.

filename attribute is missing from the image on Android platform.

If we try to hack around it and extract the name from path, the name from path is not the same as selected image's name.

  • react-native-image-crop-picker ^0.24.1
  • react-native ^0.59.8

It is working fine for me.

I used filnename= path.substring(item.path.lastIndexOf('/') + 1), to get the selected image name from its path

Hi @NeerajaaG and @ivpusic any solution to this yet? Am getting the following error, when trying to pick an image from download folder. It works Ok in the camera folder path: /storage/~/0/DCIM/Camera/... but not with /storage/~/0/Download/...

It's saying something about exifinterface, and I tried referencing the latest exifinterface from com.android.support (28+) and androidx.exifinterface (1.1.0 beta) in my build.gradle file. Could you help with this? Could this be from the cropping lib used in this package?

Error Log

08-04 03:55:19.057 6850 6880 I ExifInterface_JNI: Raw image not detected
08-04 03:55:19.060 6850 6880 W ExifInterface: Invalid image: ExifInterface got an unsupported image format file(ExifInterface supports JPEG and some RAW image formats only) or a corrupted JPEG file to ExifInterface.
08-04 03:55:19.060 6850 6880 W ExifInterface: java.io.IOException: Invalid marker: 52
08-04 03:55:19.060 6850 6880 W ExifInterface: at android.media.ExifInterface.getJpegAttributes(ExifInterface.java:1835)
08-04 03:55:19.060 6850 6880 W ExifInterface: at android.media.ExifInterface.loadAttributes(ExifInterface.java:1475)
08-04 03:55:19.060 6850 6880 W ExifInterface: at android.media.ExifInterface.(ExifInterface.java:1112)
08-04 03:55:19.060 6850 6880 W ExifInterface: at com.yalantis.ucrop.task.BitmapCropTask.crop(BitmapCropTask.java:131)
08-04 03:55:19.060 6850 6880 W ExifInterface: at com.yalantis.ucrop.task.BitmapCropTask.doInBackground(BitmapCropTask.java:91)
08-04 03:55:19.060 6850 6880 W ExifInterface: at com.yalantis.ucrop.task.BitmapCropTask.doInBackground(BitmapCropTask.java:30)
08-04 03:55:19.060 6850 6880 W ExifInterface: at android.os.AsyncTask$2.call(AsyncTask.java:305)
08-04 03:55:19.060 6850 6880 W ExifInterface: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
08-04 03:55:19.060 6850 6880 W ExifInterface: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
08-04 03:55:19.060 6850 6880 W ExifInterface: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
08-04 03:55:19.060 6850 6880 W ExifInterface: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
08-04 03:55:19.060 6850 6880 W ExifInterface: at java.lang.Thread.run(Thread.java:761)
08-04 03:55:19.060 6850 6880 I BitmapCropTask: Should crop: true
08-04 03:55:19.061 6850 6880 D uCrop JNI: Crop image with CImg
08-04 03:55:19.133 6850 6850 E image-crop-picker: Promise rejected. Cannot find image data
08-04 03:55:19.152 6850 6907 I ReactNativeJS: 'error picking image', { [Error: Cannot find image data]
08-04 03:55:19.152 6850 6907 I ReactNativeJS: framesToPop: 1,
08-04 03:55:19.152 6850 6907 I ReactNativeJS: nativeStackAndroid: [],
08-04 03:55:19.152 6850 6907 I ReactNativeJS: userInfo: null,
08-04 03:55:19.152 6850 6907 I ReactNativeJS: code: 'E_NO_IMAGE_DATA_FOUND',
08-04 03:55:19.152 6850 6907 I ReactNativeJS: line: 2116,
08-04 03:55:19.152 6850 6907 I ReactNativeJS: column: 26,

@NeerajaaG and @ivpusic you can follow up with progress here. Thanks!

Is this resolved? still can't get filename on android

same here, no filename going to use @NeerajaaG method ..
filnename= path.substring(item.path.lastIndexOf('/') + 1)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Martian2Lee picture Martian2Lee  路  3Comments

Phenek picture Phenek  路  3Comments

habovh picture habovh  路  3Comments

althurzard picture althurzard  路  3Comments

DISKONEKTeD picture DISKONEKTeD  路  3Comments