我正在尝试修改PHP_JPEG_Metadata_Toolkit中的代码,以便我可以使用 PHP 为 jpeg 文件正确读取和写入 XMP 数据。目前,jpeg 文件(由 Toolkit 保存时)由于 XMP 块而在 Adobe Photoshop 和 Bridge 中出现错误。
我看到 Photoshop 使用的 XMP RDF 架构有两种方式。第一个是 Photoshop 实际保存在 jpg 中并且我正在导入的内容。Photoshop 对所有内容都使用单个 rdf:Description 块。它在块本身内抛出许多模式标识符(url),并为许多元数据字段添加值。接下来是 Dublin Core、Photoshop、Iptc4xmpCore 等的标签块,但都集中在一个描述标签中。
第二个是在 Photoshop“文件信息”中显示的格式整齐的元数据,该元数据遵循 RDF 的XMP 文档(其中指出“按照约定,来自给定模式的所有属性,并且只有该模式,都列在单个 rdf:Description 元素中.")
通过遵循 Photoshop 实际发送的示例(一个 rdf:Description 下的所有内容),我已经能够解决 Photoshop 在工具包编辑时出现错误的问题
两个问题:知道为什么 Photoshop 保存的 XMP 元数据与它在程序中显示的不同吗?而且……为什么我要花时间将我的输出格式化为 RDF 规范,因为它在一个 rdf:Description 中运行良好,所有这些都混杂在一起?我是处理这一切的新手,所以任何指导都将不胜感激。
这些示例经过编辑,因此您可以更轻松地仅查看格式差异 - 请原谅仅来自编辑的两者之间的内容差异。
这是我实际从 Photoshop 收到的内容(已编辑):
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:xmpRights="http://ns.adobe.com/xap/1.0/rights/"
xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/"
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmpMM:DocumentID="xmp.did:8808E8B6139411E3A70AB29CEEC8FF6C"
xmpMM:InstanceID="xmp.iid:0071BBEF4517E311BCBCC2DF868D188C"
xmpMM:OriginalDocumentID=""
xmp:CreatorTool="(PHP JPEG Metadata Toolkit v1.12)"
xmp:MetadataDate="2013-09-06T15:44:49-07:00"
xmp:ModifyDate="2013-09-06T15:44:49-07:00"
xmp:CreateDate="2013-09-06T15:22:46-07:00"
xmpRights:Marked="True"
xmpRights:WebStatement="MY WEB ADDRESS"
Iptc4xmpCore:IntellectualGenre=""
photoshop:Instructions="OOOInstructions"
photoshop:Headline="OOOHeadline"
photoshop:CaptionWriter="MY NAME"
dc:format="image/jpeg">
<xmpMM:DerivedFrom stRef:instanceID="6B5F4850BB0819F254E40401F67ACAC9"
<stRef:documentID="6B5F4850BB0819F254E40401F67ACAC9"/>
<xmpRights:UsageTerms>
<rdf:Alt>
<rdf:li xml:lang="x-default">MY INFO HERE</rdf:li>
</rdf:Alt>
</xmpRights:UsageTerms>
<dc:description>
<rdf:Alt>
<rdf:li xml:lang="x-default">OOODescription
</rdf:li>
</rdf:Alt>
</dc:description>
</rdf:Description>
</rdf:RDF>
这是 Photoshop 格式精美的视图(已编辑)
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#">
<xmpMM:DocumentID>xmp.did: … ETC…</xmpMM:DocumentID>
<xmpMM:InstanceID>xmp.iid: …ETC… </xmpMM:InstanceID>
<xmpMM:OriginalDocumentID/>
<xmpMM:DerivedFrom rdf:parseType="Resource">
<stRef:instanceID>6B5F4850BB0819F254E40401F67ACAC9</stRef:instanceID>
<stRef:documentID>6B5F4850BB0819F254E40401F67ACAC9</stRef:documentID>
</xmpMM:DerivedFrom>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xmp="http://ns.adobe.com/xap/1.0/">
<xmp:CreatorTool>Adobe Photoshop CS6 (Windows)</xmp:CreatorTool>
<xmp:MetadataDate>2013-09-06T15:44:49-07:00</xmp:MetadataDate>
<xmp:ModifyDate>2013-09-06T15:44:49-07:00</xmp:ModifyDate>
<xmp:CreateDate>2013-09-06T15:22:46-07:00</xmp:CreateDate>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xmpRights="http://ns.adobe.com/xap/1.0/rights/">
<xmpRights:Marked>True</xmpRights:Marked>
<xmpRights:WebStatement>MY WEB ADDRESS</xmpRights:WebStatement>
<xmpRights:UsageTerms>
<rdf:Alt>
<rdf:li xml:lang="x-default">MY INFO HERE</rdf:li>
</rdf:Alt>
</xmpRights:UsageTerms>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/">
<Iptc4xmpCore:IntellectualGenre/>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
<photoshop:Instructions>OOOInstructions</photoshop:Instructions>
<photoshop:Headline>OOOHeadline</photoshop:Headline>
<photoshop:CaptionWriter>OOO </photoshop:CaptionWriter>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:format>image/jpeg</dc:format>
<dc:description>
<rdf:Alt>
<rdf:li xml:lang="x-default">OOODescription</rdf:li>
</rdf:Alt>
</dc:description>
</rdf:Description>
</rdf:RDF>
编辑 我很欣赏约书亚的解释。我觉得有趣/奇怪的是,似乎有两种不同的方式来列出一个值。第一个是与 tag="value" 中的等号并包含在 rdf:Description 括号内(注意关闭 rdf:Description 括号):
<rdf:Description rdf:about=""
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/" xmpRights:Marked="True"
photoshop:Instructions="Notice closing Bracket here">
</rdf:Description>
第二个是Value
<rdf:Description rdf:about=""
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
<photoshop:Instructions>OOOInstructions</photoshop:Instructions>
</rdf:Description>