I am attempting to modify the code from PHP_JPEG_Metadata_Toolkit so that I can read and write XMP data correctly for jpeg files using PHP. Currently, the jpeg files (when saved by the Toolkit) give errors with Adobe Photoshop & Bridge because of the XMP block.
There are two ways I'm seeing the XMP RDF schema used by Photoshop. The first is what Photoshop is actually saving in the jpg and which I am importing. Photoshop uses a single rdf:Description block for everything. It throws many schema identifiers (urls) within the block itself PLUS adds values for many metadata fields. Then following are tag blocks for Dublin Core, Photoshop, Iptc4xmpCore, etc., but all lumped together within a single Description tag.
The second is the neatly formatted Metadata displayed inside of Photoshop "File Info" that follows the XMP documentation for RDF (which states "By convention, all properties from a given schema, and only that schema, are listed within a single rdf:Description element.")
I've been able to fix the problem with Photoshop giving errors when edited by the Toolkit by following the example of what Photoshop actually sends (everything under one rdf:Description)
Two questions: Any idea why Photoshop saving the XMP metadata different from what it shows inside the program? And … Why should I spend the time to format my output to the RDF specs when it works nicely all jumbled together in a single rdf:Description? I am new to working with all this and so any guidance would be appreciated.
These examples are edited so you can more easily see the formatting differences only - please forgive content discrepancies between the two that are just from editing.
Here is what I am actually receiving from Photoshop (edited):
<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>
Here is Photoshops nicely formatted view (edited)
<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>
Edit I appreciate Joshua's explanation. What I find interesting/odd is that there appears to be two different ways to list a value. The first is with an equal sign as in tag="value" and included within the rdf:Description brackets (notice closing rdf:Description bracket):
<rdf:Description rdf:about=""
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/" xmpRights:Marked="True"
photoshop:Instructions="Notice closing Bracket here">
</rdf:Description>
The second is with Value
<rdf:Description rdf:about=""
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
<photoshop:Instructions>OOOInstructions</photoshop:Instructions>
</rdf:Description>