How do I extract the metadata of a local image in

2019-02-10 18:17发布

问题:

I would like to get the metadata of an image that a user drags and drops into a webpage. I have the drag and drop set up. However, the image isn't actually uploaded to a server. It's accessed locally. Can I still get the metadata from the image using Javascript? If so, how do I do this? What good libraries are there?

If not, do I absolutely have to upload the image in order to extract the metadata? What's the fastest way to upload an image in Javascript?

回答1:

There is a library: ImageInfo - read image metadata with JavaScript. Between that and local file access in HTML5 you should be able to get it.

UPDATE New link for the imageinfo library.



回答2:

Basically, JavaScript cannot "touch" your local file, you just can do that using HTML5 + JavaScript or using Flash ActionScript