Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-1700

Exif data corrupted on Android loading photos from Gallery

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.0, 2.2.0
    • None
    • cordova-android
    • None
    • Samsung Galaxy SII

    Description

      Source and Target filenames are reversed in CameraLauncher.java when returning a picture from the gallery that requires resizing.
      Exif data is being read in from the resized image (around line 433, in onActivityResult):
      if (this.encodingType == JPEG)

      { exif.createInFile(resizePath); exif.readExifData(); rotate = exif.getOrientation(); }

      And being written back to the original file, rather than the resized file that is actually returned (around line 446):
      // Restore exif data to file
      if (this.encodingType == JPEG)

      { exif.createOutFile(FileUtils.getRealPathFromURI(uri, this.cordova)); exif.writeExifData(); }

      ...
      this.callbackContext.success("file://" + resizePath + "?" + System.currentTimeMillis());

      This means that the almost nonexistent EXIF data in the output file gets written to the original file (usually doing nothing), and the valid data is not returned in the resized file. The inFile should be imagePath (or recreated), and the outfile should be resizePath.

      The sending filename back from the Camera appears to have a similar issue.

      Attachments

        1. CameraExif.patch
          3 kB
          Darryl Champagne

        Activity

          People

            bowserj Joey Robert Bowser
            dgc03052 Darryl Champagne
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: