apache / cordova-plugin-camera

Apache Cordova Plugin camera
https://cordova.apache.org/
Apache License 2.0
960 stars 1.52k forks source link

Cordova plugin camera get picture. metadata not found in cordova ios #884

Open dtsvn-thudk opened 1 month ago

dtsvn-thudk commented 1 month ago

Bug Report

Problem

Cordova plugin camera get picture. metadata not found in cordova ios

What is expected to happen?

Get metadata data when taking photos on iOS

What does actually happen?

When I upload a photo using Android, the photo has metadata information, but when I upload a photo using iOS, there is no metadata information. I used the exifjs library (https://cdn.jsdelivr.net/npm/exif-js) to test and the results are as follows: android: image

ios: image

Information

I see @erisu has committed on this issue! I see that cordova plugin camere version 7.0.0 mentions preserving metadata on ios. image

Command or Code

`

base64ToArrayBuffer: function(base64) {
          base64 = base64.replace(/^data\:([^\;]+)\;base64,/gmi, "");
          var binary = atob(base64);
          var len = binary.length;
          var buffer = new ArrayBuffer(len);
          var view = new Uint8Array(buffer);
          for (var i = 0; i < len; i++) {
              view[i] = binary.charCodeAt(i);
          }
          return buffer;
      },
  snapPicture: function(callBack) {
          navigator.camera.getPicture(successCamera, failCamera, { 
              destinationType: Camera.DestinationType.DATA_URL,
              correctOrientation: true
          });

    function successCamera(base64) {
        let arrayBuffer = base64ToArrayBuffer(base64Image);
        let dataExif = EXIF.readFromBinaryFile(arrayBuffer);
        if (dataExif && dataExif.DateTime) {
          alert("Exif Date: " + dataExif.DateTime);
        } else {
          alert("Exif Date not found!");
        }
    }
    function failCamera(message) {
        app.preloader.hide();
    }
}, 

`

Environment, Platform, Device

Platform : ios: 17.4.1, ios: 16.2 Device: iphone 12, ipad gen 10

Version information