react-native-image-crop-picker icon indicating copy to clipboard operation
react-native-image-crop-picker copied to clipboard

image response from camera is missing data

Open robsoden opened this issue 1 year ago • 2 comments

on iOS, Images picked from the photo gallery contain all the necessary data, but images shot with the camera are missing important properties - namely sourceURL and filename. This is important because using the sourceURL or filename is the only way to determine if the file is actually HEIC vs JPG so I can convert it before uploading to server.

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.40.0
  • react-native v0.72.5

Platform

Tell us to which platform this issue is related

  • iOS 17

Expected behaviour

Expect response to contain values for all image properties, including sourceURL and filename (this sample is from camera roll)

{"creationDate": "1695862377", "cropRect": null, "data": null, "duration": null, "exif": null, "filename": "IMG_6897.HEIC", "height": 4032, "localIdentifier": "FD0BAA2C-71E2-46B0-B6DC-2380DE7C0D17/L0/001", "mime": "image/jpeg", "modificationDate": "1695909752", "path": "/private/var/mobile/Containers/Data/Application/C2111BA7-C610-4F3F-9BA4-885C0A3424C6/tmp/react-native-image-crop-picker/E672636B-04FA-4397-934A-87B681AFB7C0.jpg", "size": 1339735, "sourceURL": "file:///var/mobile/Media/DCIM/106APPLE/IMG_6897.HEIC", "width": 3024}

Actual behaviour

(this sample is from camera)

{"creationDate": null, "cropRect": null, "data": null, "duration": null, "exif": null, "filename": null, "height": 4032, "localIdentifier": null, "mime": "image/jpeg", "modificationDate": null, "path": "/private/var/mobile/Containers/Data/Application/C2111BA7-C610-4F3F-9BA4-885C0A3424C6/tmp/react-native-image-crop-picker/F0A39A7A-5472-48C6-931B-09E7ED1A69ED.jpg", "size": 2549145, "sourceURL": null, "width": 3024}

Steps to reproduce

  1. call ImagePicker.openCamera

  2. take a photo

  3. echo the response

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

robsoden avatar Oct 03 '23 15:10 robsoden

same issue happening when I am using

HassanNaeem555 avatar Oct 10 '23 14:10 HassanNaeem555

I have the same issue there is a workaround you can use the path provided in the return from the capture image by camera concatenation with file:// @robsoden for example

const result = await ImagePicker.openCamera({ mediaType: 'any', cropping: true, freeStyleCropEnabled: true, });

console.log(`file://${result.path}`);

you get the full path for the captured file like sourceURL which not working for now

Mohamedghaly140 avatar Oct 16 '23 16:10 Mohamedghaly140