Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exif.getExif() callback are not called #14

Open
alainib opened this issue Oct 3, 2017 · 5 comments
Open

Exif.getExif() callback are not called #14

alainib opened this issue Oct 3, 2017 · 5 comments

Comments

@alainib
Copy link

alainib commented Oct 3, 2017

i get a bug on IOS , on android it work ( logs are displayed )
my problem is the getExif() don't call the callback, nothing happen.

my test code :

 import ImagePicker from "react-native-image-crop-picker"; // version "^1.2.2"
  import Exif from "react-native-exif";  // version "0.1.5"
 


testfromlib(){
  ImagePicker.openPicker({
    width: 300,
    height: 400,
    cropping: false
  }).then(image => {
    console.log(image); // this log me the image object : 
    /* log this :
      data  :  null
      exif  :  null
      filename  :  "IMG_0338.JPG"
      height  :  3264
      localIdentifier  :  "7388B8DC-A2B6-4ECD-B02E-7EC3432AECBC/L0/001"
      mime  :  "image/jpeg"
      path  :  "/private/var/mobile/Containers/Data/Application/27EA2F8F-039F-400F-B32A-836768451015/tmp/react-native-image-crop-picker/9AEA097A-6989-4D02-A775-FCF7E64D2747.jpg"
      size  :  8499929
      sourceURL  :  "file:///var/mobile/Media/DCIM/100APPLE/IMG_0338.JPG"
      width  :  2448
    */ 
    console.log("exif from "+ image.sourceURL);
    // log this : "exif from file:///var/mobile/Media/DCIM/100APPLE/IMG_0338.JPG" 
   
    Exif.getExif(image.sourceURL)
      .then(msg => {
        console.log("selected image exif", msg);              // NOT LOGGED  !
      }).catch(msg => console.log("ERROR: " + msg));   // NOT LOGGED  !
  });
}

from camera roll it work :

  testfromcamera(){
    ImagePicker.openCamera({
      width: 300,
      height: 400,
      cropping: false
    }).then(image => {
      console.log("exif from "+ image.path);
      //log this :  exif from /private/var/mobile/Containers/Data/Application/27EA2F8F-039F-400F-B32A-836768451015/tmp/react-native-image-crop-picker/EF3F7E1D-DE76-4D48-9C5A-AB80608095E1.jpg
      Exif.getExif(image.path)
        .then(msg => {
          console.log("selected image exif", msg);  // log is displayed           
        }).catch(msg => console.log("ERROR: " + msg));
    });
  }

what i'm trying to do is

  1. to let user to choose between taking a new shoot with camera or loading one from gallery,
  2. get the exif of the image
  3. crop the image

did i miss something in the testfromlib function ?

@alainib
Copy link
Author

alainib commented Oct 3, 2017

i solved the problem by using only imagePicker , they add exif in last version

  openCameraCropper(){
    ImagePicker.openCamera({
      includeExif:true,
      cropping: true,
      width: 300,
      height: 400,
      compressImageMaxWidth: 900,
      compressImageMaxHeight: 900,
      compressImageQuality: 0.72
    }).then(image => {  
      this.processDataImage(image);      
    });
  }

  openPickerCropper(){
    ImagePicker.openPicker({
      includeExif:true,
      cropping: true,
      width: 300,
      height: 400,
      compressImageMaxWidth: 900,
      compressImageMaxHeight: 900,
      compressImageQuality: 0.72
    }).then(image => {
      this.processDataImage(image);
    });
  }

  
  processDataImage(image) {
    console.log("process image 1",image);    
    this.setState({
      currentProcessedImage: {
        uid: tools.generateUUID(),
        uri: image.path,
        exif:image.exif,
        id: this.state.imagesToSend.length
      },
      modalOrganeVisible: true
    });
  }

@alainib alainib closed this as completed Oct 3, 2017
@dancherb
Copy link

dancherb commented Jul 3, 2018

This is still a problem with the react-native-exif library - I can't use image-picker and do want this to work on iOS, please re-open! @alainib

@alainib alainib reopened this Jul 4, 2018
@dancherb
Copy link

dancherb commented Jul 4, 2018

Seems like it's called on the simulator when I slice out the "file:///"" at the start of a path, but not on my device. Seems like if it fails for whatever reason, it doesn't return an error but is just silent. @francisco-sanchez-molina

@jtweaver
Copy link
Contributor

I'm having this same issue. Also works on the simulator (and strangely my iPhone X, but not any other iPhones). No error but doesn't call the callback. I've tried with promise and async/await. Any solutions?

@jtweaver
Copy link
Contributor

I fixed this issue in my branch (PR #33) with a new method getExifWithLocalIdentifier(). There was a permission issue with getting the photo using the local path. It only showed up on some phones. The new method should work for all iOS phones though. It uses the local identifier of the photo instead of the source URL/path, if you have that available (which if your using react-native-image-crop-picker or react-native-image-picker, you should).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants