如何向图像添加元数据?

发布于 2024-09-14 06:55:08 字数 48 浏览 3 评论 0 原文

在哪里将元数据插入到图像文件中?这样做的标记是什么?我想用 php 来做到这一点。

Where does one insert meta data into and image file and what it the mark up to do so? i want to do this with php.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

黑寡妇 2024-09-21 06:55:09

PHP 集成到图像中;)

http://bechtsoudis.com/archive/2011/09/08/php-code-into-jpeg-metadata-from- hide-to-unhide/index.html

JPEG、TIFF、PSD、Raw 和其他几种文件格式可以包含任何或所有以下标准类型的元数据:

IPTC-IIM
该模式通常被称为“传统”IPTC,是在 20 世纪 90 年代初开发的,主要是为了帮助新闻机构为早期数字图像添加字幕。它的主要优点是大多数图像编辑和管理程序都可以读取和写入其广泛兼容的字段。

IPTC 核心与扩大
这个新模式建立在 IIM 的基础上,添加了更多类型的描述性和管理信息,包括满足图库摄影和文化遗产社区需求的新字段,并以更强大的数据格式“XMP”打包。


用于识别和定义图像使用许可证的图片许可通用系统描述了用于生成字符串的模式和工具,该字符串可以识别版权所有者、用户、许可图像使用的范围和条款。

XMP
这是 IPTC 核心和扩展用于存储和访问图像元数据的较新数据格式。它支持将元数据存储在图像文件或随附的 sidecar 文件中,并且允许创建自定义元数据字段。

埃克斯夫
这些元数据通常由相机和其他捕获设备创建,包括有关图像及其捕获方法的技术信息,例如曝光设置、捕获时间、GPS 位置信息和相机型号。

都柏林核心
许多图像库和各种行业都使用此模式将信息与图像文件一起存储。它的几个字段可以与 IPTC 格式互操作。

Php integration into images ;)

http://bechtsoudis.com/archive/2011/09/08/php-code-into-jpeg-metadata-from-hide-to-unhide/index.html

JPEG, TIFF, PSD, Raw and several other file formats can include any or all the following standard types of metadata:

IPTC-IIM
Often called "legacy" IPTC, this schema was developed in the early 1990s, primarily to aid news organizations in captioning early digital images. Its primary advantage is that most image editing and management programs can read and write its widely compatible fields.

IPTC Core & Extension
This newer schema builds on the legacy of IIM by adding more types of descriptive and administrative information, including new fields to accommodate the needs of the stock photography and cultural heritage communities, packaged in a more robust data format, "XMP."

PLUS
The Picture Licensing Universal System for identifying and defining image-use licenses, describes a schema and tools for generating a string of characters that can identify a copyright holder, user, scope and terms of a licensed image use.

XMP
This is the newer data format used by IPTC Core and Extension for storing and accessing image metadata. It enables metadata storage within an image file or in an accompanying sidecar file, and it permits creation of custom metadata fields.

Exif
These metadata, often created by cameras and other capture devices, include technical information about an image and its capture method, such as exposure settings, capture time, GPS location information and camera model.

Dublin Core
Many image libraries and a wide variety of industries store information with image files using this schema. Several of its fields are interoperable with IPTC formats.

鹿童谣 2024-09-21 06:55:09

这样的图像库

您可以使用像 imagemagick http://www.imagemagick 。 imagemagick.org/discourse-server/viewtopic.php?f=1&t=20183

我知道另一个名为 Jhead 的工具,它可以检索和修改一些元数据,如果图像

http://www.sentex.net/~mwandel/jhead/

You can use image libraries like imagemagick

http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=20183

There is another tool I know named Jhead which can retieve and modify some metadata if images

http://www.sentex.net/~mwandel/jhead/

乖乖 2024-09-21 06:55:09

您可以使用 PHP 中的 iptcembed 函数向图像添加信息。
用法可以在以下位置找到: http://php.net/manual/en/function.iptcembed .php

添加的数据可以使用 iptcparse 函数检索。

让我知道这是否适合您。

You can go for iptcembed function in PHP to add information to image.
usage could be found at: http://php.net/manual/en/function.iptcembed.php

Added data could be retrieved using iptcparse function.

Let me know if this works for you.

故乡的云 2024-09-21 06:55:09

您可以选择更简单的替代方案,即使用 exiftool 命令行工具。

为了使用它,我今天为个人项目编写了一个简单的 PHP 脚本,该脚本将写入纬度/经度信息(如果您已经在 PHP 变量中拥有它)。

并且,非常重要的是,在之前的基础上添加 GPSLatitudeRef 和 GPSLongitudeRef 值的方法。基本上,如果纬度为正,则 GPSLatitudeRef 应具有“北”值,如果为负,则应具有“南”值。对于 GPSLongitudeRef 是相同的,但正时为“东”,负时为“西”。

$bashExifEdit = "";
$longitudeRef = "East";
if ($longitude < 0) {
    $longitudeRef = "West";
}
$latitudeRef = "North";
if ($latitude < 0) {
    $latitudeRef = "South";
}

if ($sleepingPlace != null) {
    $bashExifEdit .= "exiftool -GPSLongitude=\"".$longitude."\"  -GPSLatitude=\"".$latitude.".\" -GPSLatitudeRef=\"$latitudeRef\" -GPSLongitudeRef=\"$longitudeRef\"  images/your_image.jpg\n";
}

这将为每个图像生成一个字符串,其中包含结束符。如果您添加一个 for 那么您可以将 $bashExifEdit 的内容写入其中,瞧!一种根据图像的纬度/经度自动设置所有 GPS 详细信息(海拔高度除外,与纬度/经度没有太大区别)的方法。

You can opt for a simpler alternative, that will use the exiftool command line tool.

To use it, I have coded today for a personal project a simple PHP script that will write the Latitude/Longitude info, if you already have it in PHP variables.

And, which is very important, a way of adding the GPSLatitudeRef and GPSLongitudeRef values based on the previous ones. Basically, if the Latitude is positive, then GPSLatitudeRef should have the "North" value, and "South" if negative. For GPSLongitudeRef is the same, but being "East" when positive, and "West" when negative.

$bashExifEdit = "";
$longitudeRef = "East";
if ($longitude < 0) {
    $longitudeRef = "West";
}
$latitudeRef = "North";
if ($latitude < 0) {
    $latitudeRef = "South";
}

if ($sleepingPlace != null) {
    $bashExifEdit .= "exiftool -GPSLongitude=\"".$longitude."\"  -GPSLatitude=\"".$latitude.".\" -GPSLatitudeRef=\"$latitudeRef\" -GPSLongitudeRef=\"$longitudeRef\"  images/your_image.jpg\n";
}

This will generate a string, with and endline character for each image. If you add a for then you can just write to it the content of $bashExifEdit, and voilà! An automated way of setting all the GPS details (except the altitude, which is not that different than the latitude/longitude) based on a latitude/longitude for your images.

仙女 2024-09-21 06:55:09

我最近在 w3c 博客上看到一篇非常酷的文章,内容是关于结合 RDFa 和 HTML 来丰富图像,不仅指定图像中的内容,还指定它在图像中的位置:http://www.w3.org/QA/2008/01/rdfa_and_html_imagemap.html< /a>

I recently saw a really cool article on the w3c blog about combining RDFa and an HTML <imagemap> to enrich images by specifying not only what's in the image but also where it is in the image: http://www.w3.org/QA/2008/01/rdfa_and_html_imagemap.html

是伱的 2024-09-21 06:55:09

在 PHP 中,您可以使用标头:

示例:

 header('Content-Length: ' . filesize($file));  /// that's the file size 

您可以添加更多类似的标头,它会起作用。您甚至可以发送一些自定义标头,它仍然会起作用:)

In PHP you can use headers:

example:

 header('Content-Length: ' . filesize($file));  /// that's the file size 

You can add more headers like that one and it will work.You can even send some custom headers and it will still work :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文