Open ghost opened 3 years ago
bump :)
Is there no solution?
I think I have a solution.
I'm not sure it is the right issue though, as in my cases, the images where not .heic and the issue comes from requireLegacyExternalStorage
to be removed from the manifest.
The issue is the permission denied (eaccess) for the BitmapFactory to decode the file.
The path return by RealPathUtil
is correct but does not grant any read/write possibility, thus we need to copy the file.
I've taken the code from the Flutter (yes Flutter) image_picker
following this issue and this PR with up to date change from today.
It is only for images, so usage may vary but you should be able to adapt it easily.
Here is the patch file to be applied using npm patch
package:
react-native-image-crop-picker+0.36.2.patch.zip
Based on the discussion from Flutter repo, the RealPath utils could probably be re-written totally using this with some minor adaptation for video.
I was experiencing the issue that @HugoGresse describes and the patch package seems to have fixed it! 🌟 Thank you.
I was getting E_NO_IMAGE_DATA_FOUND
when calling openPicker
and selecting images from the gallery but was able to successfully select the same image when it was stored on the device itself.
Originally I thought that the issue was the .heic
format but I think that may have been a red herring in my case with the actual issue being the location of the image.
I am now able to select .heic
files from the device and the image picker seems to be converting them to jpgs
which is acceptable behaviour for my use case.
when I try crop an image in .heic format (using ImagePicker.openCropper) returned error (Error: Cannot find image data)
Version react-native-image-crop-picker v0.34.1 react-native v0.63.0
Platform Android
Is there any solution ?
make sure you set cropping = false when mediaType is 'video'
+1 for this. Even though .heic is an Apple format, Android phones are still able to read it. Would be great to add support for .heic on Android, but would also help a lot just catching the error avoiding a crash.
+1 for this. Even though .heic is an Apple format, Android phones are still able to read it. Would be great to add support for .heic on Android, but would also help a lot just catching the error avoiding a crash.
i face this issue
Error: Cannot find image data
An error message is r returned when tried to upload an image from gallery, which is in .heic format.
Version
Platform
Expected behaviour
Return the image selected from gallery
Actual behaviour
Throws 'E_NO_IMAGE_DATA_FOUND '
Steps to reproduce
1.Open image from gallery (.heic format)
I found
forceJpg
prop can be used in iOS. Is there any solution or any way to convert .heic files to compatible format in android ? Thanks in advance