I am developing a small web application for mobile and I am using canvas to draw the images on screen before uploading it to the server.

Before the upload, I want to know if the photo was taken from the camera roll or taken by the device camera.

It will also be good for me to know the photo's original date.

I know how to do it in Android, but in iOS, this data is unavailable in the EXIF data, until the image is uploaded to the device.

I have found this question: how to detect where the image is coming from, but it has no answers.

I am using Exif.js to extract the metadata in the client side.

Any ideas?

adding the code for extracting EXIF data

 $scope.handleFileInput = function (file, invalidFiles) {
        //var file = $scope.photoInput.files[0];
        if (file) {
            if (/^image\//i.test(file.type)) {
                $scope.readFile(file);
            } else {
                alert('Not a valid image!');
            }
        }
    };

    $scope.readFile = function (file) {
        var reader = new FileReader();

        reader.onloadend = function (d) {
            var exif = EXIF.readFromBinaryFile(d.target.result);
            photoService.validatePhoto(exif.DateTimeOriginal);

            //alert('exif.DateTime = ' + exif.DateTime);
            //alert('exif.DateTimeOriginal = ' + exif.DateTimeOriginal);
            //alert('exif.DateTimeDigitized = ' + exif.DateTimeDigitized);

            $scope.processFile(file, exif.Orientation);
        }

        reader.onerror = function () {
            alert('There was an error reading the file!');
        }

        reader.readAsArrayBuffer(file);
    };
0

There are 0 best solutions below