开发者

Extracting jpeg EXIF information using jQuery

I'm trying to extract EXIF information from images using jQuery.

I've tried using a script I found here but I can't get it to read exif data from externally hosted image files. I've posted a simpl开发者_如何学运维e example page here. The code is tiny so you can just view-source to see what I tried.

Does anyone know either what I'm doing wrong or if there there is another way to do it?

-Matt


The plugin works off requesting the image again via a binary XmlHttpRequest, something you just can't do on a remote domain due to the same-origin policy...the browser does a pretty good job of (by default) separating which domains interact with others, this is one of those cases (for security reasons).

Sorry the answer sucks, but I don't think you're not going to be able to do this on a remote image, on a domain you don't control.


You'll either have to proxy the images on the same hostname or get the external host to send appropriate access control headers to allow you to request data on their site through JavaScript.


I always wondered how people seem to think anything could be done with javascript. Given a remote image, isn't it obvious you could(should) download the image on the server and do the special processing there?

Also, what makes you think jQuery can do things javascript doesn't? What you are looking for is, at it's best, something that needs to be supported in plain javascript.

Really, parsing a remote binary file locally? Sure it's a nice hack, but why not settle for the real/pro solution, make the server parse the image?

Rant aside, the JS lib cannot work on remote files, and this can't be ever done with plain JS.

You should be downloading the file on your server and parsing it from there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜