Extracting EXIF data with JavaScript

强颜欢笑 提交于 2021-02-08 19:54:29

问题


I'm evaluating image upload techniques using Canvas for a mobile web app. The sticking point is reading EXIF data client-side. Other discussions on this site point towards the excellent Blueimp JavaScript Image Load. I particularly want to extract from EXIF:

  • date & time of photo taken
  • Geopositioning - latitude & longitude of photo taken

Testing the Blueimp script on Firefox v.33.1 on Windows Vista using a photo taken on an iPhone (with geo data), it successfully extracts all the EXIF data including date, time & geocoords. Running the same test with the same photo on iOS and it only extracts a tiny amount of EXIF data - just the dimensions and orientation (I'm using iPhone 5, iOS 8.1), nothing else. Why is this? Is there a fix or an alternative JavaScript EXIF extraction tool to recommend?

Suggestions very gratefully received as this is doing my head in!! Thanks in advance.

Please note: I don't want to do it server-side with PHP because this requires uploading the full image, which can be slow on mobile bandwidth, hence going for the canvas option to resize images client-side.


回答1:


After more reading around on this issue, a similar question was asked here a year ago, with no satisfactory responses. According to one commenter, uploaded files on iOS devices only get access to a sanitized version of the file for privacy reasons. This means what useful stuff like time/date and GPS is stripped out of a file before it is made available to the browser.

Which kind of scuppers this idea. :(



来源:https://stackoverflow.com/questions/27061122/extracting-exif-data-with-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!