使用Javascript上传图片后,能否获得exif数据? [英] Can you get the exif data upon image upload using Javascript?

查看:91
本文介绍了使用Javascript上传图片后,能否获得exif数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个输入文件类型:

I have an input file type:

<input type='file' id='upload_files' name='upload_files' file-model='upload_files'/>

我希望能够从上传的图像中提取exif数据(如果存在).可以单独使用javascript/angularjs吗?

I want to be able to extract the exif data if it exists from the uploaded image. Can this be done with javascript/angularjs alone?

我尝试使用exif_read_data(),但似乎到了这一点,exif数据已经丢失.

I tried using exif_read_data() but it seems that by the time it reaches this point, the exif data has already been lost.

推荐答案

解决方案:

这是对我有用的解决方案.我使用 exif-js JavaScript库从上传的图片中提取exif数据(如果有)存在.

This is the solution that has worked for me. I used exif-js JavaScript library to extract the exif data from an uploaded image if it exists.

进一步使用:

我需要exif数据来获取图像的原始方向.我使用了exif数据的提取功能,并将数据写入了文件中.我保存了此文件供以后使用,还使用它从图像的原始状态提取了Orientation值.我使用此值适当旋转最终图像.

I needed the exif data to get the original orientation of an image. I used the extraction of the exif data and I wrote the data into a file. I saved this file for later use and also use it to extract the Orientation value from the original state of the image. I use this value to appropriate rotate the final image.

这篇关于使用Javascript上传图片后,能否获得exif数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆