php 如何从 EXIF 获取相机序列号?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5857820/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get camera serial number from EXIF?
提问by Mawg says reinstate Monica
How to get camera serial number from EXIF ?
如何从 EXIF 获取相机序列号?
Edit: some folk think that not all (or even many) cameras store serial number, but I tried four from different manufacturers and they do. So, let's just rephrase it as "How to get camera serial number from EXIF if there is any?"
编辑:有些人认为并非所有(甚至很多)相机都存储序列号,但我尝试了来自不同制造商的四个,他们确实这样做了。所以,让我们把它改写为“如果有的话,如何从 EXIF 获取相机序列号?”
采纳答案by David
First the camera would have to write its serial number to the EXIF data. I don't know of any that do.
首先,相机必须将其序列号写入 EXIF 数据。我不知道有任何人这样做。
But in any event, you'll have to check with the documentation of the specific camera in question to see if it writes this value and where it writes it. There's no standard place for it, since it's not a standard thing to write (such as Manufacturer
or Model
).
但无论如何,您都必须检查相关特定相机的文档,以查看它是否写入此值以及写入位置。它没有标准的地方,因为它不是标准的写东西(例如Manufacturer
或Model
)。
You can see a lot about the EXIF specifications here.
回答by matt burns
As has been mentioned, not all cameras store the serial number. However, most of the DSLRs do.
如前所述,并非所有相机都存储序列号。但是,大多数数码单反相机都可以。
The serial number is actually stored in the MakerNotes section of the EXIF. This is a proprietary section for manufacturers to write in whatever format they like.
序列号实际上存储在 EXIF 的 MakerNotes 部分。这是制造商以他们喜欢的任何格式编写的专有部分。
I've extended the great work by Jacob Seidelin(< edit: the URL is a 404) to extract the serial number with javascript on my Sitewhich includes an offline version for Chrome for no other reason than to see if I could! It's open source so if you're looking for a javascript solution you're welcome to build on it etc.
我已经扩展了Jacob Seidelin(< 编辑:URL 是 404)的伟大工作,以在我的网站上使用 javascript 提取序列号,其中包括 Chrome 的离线版本,只是为了看看我是否可以!它是开源的,所以如果你正在寻找一个 javascript 解决方案,欢迎你在它的基础上进行构建等等。
The question doesn't include a programming language or any contsraints so the best answer currently is to use exiftool. It has the most complete support for different camera models and file formats (including brilliant support for how different applications butcher it!)
该问题不包括编程语言或任何限制,因此目前最好的答案是使用exiftool。它对不同的相机型号和文件格式有最完整的支持(包括对不同应用程序如何屠宰它的出色支持!)
A simple example command to get the serial number would be:
获取序列号的简单示例命令是:
exiftool -SerialNumber myImage.jpg
I writing my site, I've looked into this topic over hundredsof hours so if you have any more questions, let me know!
我正在写我的网站,我已经研究了数百个小时的这个主题,所以如果您有任何问题,请告诉我!
回答by Michael C
Almost all DSLR cameras code the serial number into the EXIF info in the maker notes section. The reason most people don't see it in the EXIF info is that Adobe products all but ignore the maker notes section of the EXIF info. So if you are viewing the EXIF info using an Adobe product you won't see the serial number. But that doesn't mean it isn't there, it just means Adobe isn't displaying it.
几乎所有数码单反相机都将序列号编码到制造商注释部分的 EXIF 信息中。大多数人在 EXIF 信息中看不到它的原因是 Adobe 产品几乎忽略了 EXIF 信息的制造商注释部分。因此,如果您使用 Adobe 产品查看 EXIF 信息,您将看不到序列号。但这并不意味着它不存在,只是意味着 Adobe 没有显示它。
回答by Bjoern
You can use exif_read_data
to access EXIF information in php. A good code sample on how to use this command is shown in the manual within the link below.
您可以使用exif_read_data
php 访问 EXIF 信息。下面链接中的手册中显示了有关如何使用此命令的良好代码示例。
http://www.php.net/manual/en/function.exif-read-data.php
http://www.php.net/manual/en/function.exif-read-data.php
But afaik currently not many cameras code the serial numbers into the EXIF blocks.
但是 afaik 目前没有多少相机将序列号编码到 EXIF 块中。