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.
在哪里插入元数据和图像文件,它的标志是什么?我想用php来做这个。
6 个解决方案
#1
4
Php integration into images ;)
将Php集成到图像中;)
http://bechtsoudis.com/archive/2011/09/08/php-code-into-jpeg-metadata-from-hide-to-unhide/index.html
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:
JPEG、TIFF、PSD、Raw和其他几种文件格式可以包含以下任何或所有标准类型的元数据:
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- iim通常被称为“遗留”IPTC,这种模式是在20世纪90年代初开发出来的,主要是为了帮助新闻机构为早期的数字图像配上字幕。它的主要优点是大多数图像编辑和管理程序都可以读写其广泛兼容的字段。
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."
IPTC Core & Extension这个更新的模式建立在IIM遗留的基础上,它添加了更多类型的描述和管理信息,包括新字段,以满足库存摄影和文化遗产社区的需求,并以更健壮的数据格式“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.
这是IPTC Core和扩展用于存储和访问图像元数据的最新数据格式。它允许在图像文件或伴随的sidecar文件中存储元数据,并允许创建自定义元数据字段。
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.
Exif这些元数据通常是由摄像机和其他捕获设备创建的,包括关于图像及其捕获方法的技术信息,如曝光设置、捕获时间、GPS定位信息和摄像机模型。
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.
都柏林核心的许多图像库和广泛的行业存储信息与图像文件使用这个模式。它的几个字段可以与IPTC格式互操作。
#2
2
You can use image libraries like imagemagick
您可以使用像imagemagick这样的图像库
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=20183
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
我还知道另一个名为Jhead的工具,它可以重新启动并修改一些图片中的元数据
http://www.sentex.net/~mwandel/jhead/
http://www.sentex.net/ mwandel / jhead /
#3
1
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
可以使用PHP中的iptcembed函数向图像添加信息。用法可以在http://php.net/manual/en/function.iptcembed.php找到
Added data could be retrieved using iptcparse function.
可以使用iptcparse函数检索添加的数据。
Let me know if this works for you.
如果对你有用,请告诉我。
#4
0
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
最近,我在w3c博客上看到了一篇非常酷的文章,关于将RDFa和HTML
#5
0
In PHP you can use headers:
在PHP中,可以使用header:
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 :)
你可以添加更多的头文件,这样就可以了。你甚至可以发送一些自定义的标题,它仍然可以工作:)
#6
0
You can opt for a simpler alternative, that will use the exiftool
command line tool.
您可以选择一个更简单的替代方案,它将使用exiftool命令行工具。
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.
为了使用它,我今天为一个个人项目编写了一个简单的PHP脚本,如果您已经有了PHP变量,它将编写纬度/经度信息。
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.
这是一种非常重要的方法,可以在前面的基础上增加GPSLatitudeRef和GPSLongitudeRef的值。基本上,如果纬度是正的,那么GPSLatitudeRef应该有“North”值,如果是负的,应该有“South”值。因为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";
}
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.
这将生成一个字符串,每个图像都带有和endline字符。如果您添加一个for,那么您可以将$bashExifEdit的内容写入它,瞧!一种自动设置所有GPS细节的方法(除了高度,它与纬度/经度没有什么不同),基于您的图像的纬度/经度。
#1
4
Php integration into images ;)
将Php集成到图像中;)
http://bechtsoudis.com/archive/2011/09/08/php-code-into-jpeg-metadata-from-hide-to-unhide/index.html
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:
JPEG、TIFF、PSD、Raw和其他几种文件格式可以包含以下任何或所有标准类型的元数据:
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- iim通常被称为“遗留”IPTC,这种模式是在20世纪90年代初开发出来的,主要是为了帮助新闻机构为早期的数字图像配上字幕。它的主要优点是大多数图像编辑和管理程序都可以读写其广泛兼容的字段。
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."
IPTC Core & Extension这个更新的模式建立在IIM遗留的基础上,它添加了更多类型的描述和管理信息,包括新字段,以满足库存摄影和文化遗产社区的需求,并以更健壮的数据格式“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.
这是IPTC Core和扩展用于存储和访问图像元数据的最新数据格式。它允许在图像文件或伴随的sidecar文件中存储元数据,并允许创建自定义元数据字段。
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.
Exif这些元数据通常是由摄像机和其他捕获设备创建的,包括关于图像及其捕获方法的技术信息,如曝光设置、捕获时间、GPS定位信息和摄像机模型。
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.
都柏林核心的许多图像库和广泛的行业存储信息与图像文件使用这个模式。它的几个字段可以与IPTC格式互操作。
#2
2
You can use image libraries like imagemagick
您可以使用像imagemagick这样的图像库
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=20183
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
我还知道另一个名为Jhead的工具,它可以重新启动并修改一些图片中的元数据
http://www.sentex.net/~mwandel/jhead/
http://www.sentex.net/ mwandel / jhead /
#3
1
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
可以使用PHP中的iptcembed函数向图像添加信息。用法可以在http://php.net/manual/en/function.iptcembed.php找到
Added data could be retrieved using iptcparse function.
可以使用iptcparse函数检索添加的数据。
Let me know if this works for you.
如果对你有用,请告诉我。
#4
0
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
最近,我在w3c博客上看到了一篇非常酷的文章,关于将RDFa和HTML
#5
0
In PHP you can use headers:
在PHP中,可以使用header:
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 :)
你可以添加更多的头文件,这样就可以了。你甚至可以发送一些自定义的标题,它仍然可以工作:)
#6
0
You can opt for a simpler alternative, that will use the exiftool
command line tool.
您可以选择一个更简单的替代方案,它将使用exiftool命令行工具。
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.
为了使用它,我今天为一个个人项目编写了一个简单的PHP脚本,如果您已经有了PHP变量,它将编写纬度/经度信息。
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.
这是一种非常重要的方法,可以在前面的基础上增加GPSLatitudeRef和GPSLongitudeRef的值。基本上,如果纬度是正的,那么GPSLatitudeRef应该有“North”值,如果是负的,应该有“South”值。因为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";
}
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.
这将生成一个字符串,每个图像都带有和endline字符。如果您添加一个for,那么您可以将$bashExifEdit的内容写入它,瞧!一种自动设置所有GPS细节的方法(除了高度,它与纬度/经度没有什么不同),基于您的图像的纬度/经度。