danialfarid / ng-file-upload

Lightweight Angular directive to upload files with optional FileAPI shim for cross browser support
MIT License
7.87k stars 1.59k forks source link

Possible to read geolocation from uploaded image using exif? #2129

Open iwanmcm opened 4 years ago

iwanmcm commented 4 years ago

I am wondering, if it is possible to read the Exif metadata that is attached to image files to read the geolocation using ng-file-upload.

There are options (e.g. ngf-fix-orientation) that make use of the meta data of the Exif object. But, after selecting the file, it doesn't contain any exif information anymore.

I tried: ngf-before-model-change="beforeChange($files)"

With: $scope.beforeChange = function(files){ console.log('BeforeChangefiles', files); };

The result is as follows: 0: File name: "IMG_5277.JPG" lastModified: 1559123113000 lastModifiedDate: Wed May 29 2019 11:45:13 GMT+0200 (Mitteleuropäische Sommerzeit) {} webkitRelativePath: "" size: 3741545 type: "image/jpeg" $ngfBlobUrl: "blob:http://localhost/630d0c34-07a1-4f41-81fd-e2cf021cbf65" $ngfWidth: 4032 $ngfHeight: 3024

The Exif information seems to be lost at this point already.

Is it somehow possible to access the exif information, before it is lost?