react-native-image-picker: [🐛] Error processing request body: Could not find image file

Description

Error when trying to upload image from gallery

Simulator Screen Shot - iPhone 12 - 2023-04-20 at 13 10 32

Running the example app of this repo gives me the same issue:

https://user-images.githubusercontent.com/2533919/233574721-ce717d9a-9a00-4f30-b912-483a18f16afd.mp4

How to repeat issue and example

const imagePickerDefaultOptions = {
  selectionLimit: 0,
  mediaType: 'photo' as MediaType,
  includeBase64: false,
  includeExtra: true,
};

launchImageLibrary(imagePickerDefaultOptions, (imgPickerResponse) => {
    if (imgPickerResponse.assets?.[0]) {
      onPhotoTaken(imgPickerResponse.assets?.[0]);
    }
  });

Solution

What needs to be done to address this issue?

Additional Information

  • Image Picker version: >=4.10.3
  • React Native version: 0.66.1 and 0.71.2
  • Platform: iOS
  • Development Operating System: MacOS
  • Dev tools: Xcode 14.0.1, iOS 16.0

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 4
  • Comments: 27

Most upvoted comments

Seems to only happen for me on the sim flower image (the one picked in the video above), which is marked as HDR and has image type of HEIC when viewed in the photos app

@dmsierra11 I believe the problem is here.

Successfully selected image:

{
  "fileName":"5693202E-E952-4C0D-A69B-2FF9B0F6C688.jpg",
  "fileSize":993045,
  "height":2500,
  "type":"image/jpg",
  "uri":"file:///Users/mayderson/Library/Developer/CoreSimulator/Devices/D555E641-C03B-407D-9251-28DBEF5BFEE6/data/Containers/Data/Application/D641C420-4AE4-49AB-A63B-5B05E88F59D7/tmp/5693202E-E952-4C0D-A69B-2FF9B0F6C688.jpg",
  "width":1668
}

Error selected image:

{
  "fileName":"B22A70A5-D144-4857-8249-97C1FDB3FAE1.jpg",
  "height":0,
  "type":"image/jpg",
  "uri":"file:///Users/mayderson/Library/Developer/CoreSimulator/Devices/D555E641-C03B-407D-9251-28DBEF5BFEE6/data/Containers/Data/Application/D641C420-4AE4-49AB-A63B-5B05E88F59D7/tmp/B22A70A5-D144-4857-8249-97C1FDB3FAE1.jpg",
  "width":0
}

In other words, the height and width attributes are coming with 0 and the fileSize is not coming, which is causing this problem.

I had a similar encounter with a captivating sunflower image. If anyone else has experienced this issue with different images, I would greatly appreciate it if you could kindly share your observations.

I had the same issue I believe its crashing for the image which are not available like the one that are on cloud. Once the cloud image is downloaded it does not crash.

same issue on "react-native-image-picker": "^7.0.0",

Use react-native-image-crop-picker

I had a similar encounter with a captivating sunflower image. If anyone else has experienced this issue with different images, I would greatly appreciate it if you could kindly share your observations.