OK, so I have a task. I need to embed data from a database into an image using an XMP layer. Where to start?

Firstly I know a little about metadata embedding. Most are probably familiar with EXIF (EXchangeable Image Format), data that's embedded natively by most modern digital cameras into images. Tapping into EXIF headers will expose a plethora of information about what focal length was used, exposure time, make and model of camera etc... With EXIF class files available for PHP, and even limited native support built into PHP, retrieving and using that data is pretty straightforward.

Then there is IPTC Information Interchange Model or IIM, another layer of meta-data that allows for information to be embedded into various image files. However, for the most part this has now been superseded by Adobe's Extensible Metadata Platform or XMP.

Dealing with XMP in PHP is a little more complicated. In time, I think, you will natively have the ability to interactive with the XMP layer through PHP, at the moment though there doesn't appear to be that ability. PHP does provide the ability to access and manipulate IPTC data through it's iptcembed() and iptcparse() functions, but it seems that newer versions of Photoshop and XMP aware applications do not consider IPTC data authoritative.

XMP is defining the path towards a more semantic web.

[XMP] is an important piece that brings the Semantic Web closer to realization.
- Eric Miller, W3C Semantic Web Activity Lead

You have all this data out there in the ether, but it all comes back to that Charles Babbage philosophy "Garbage In, Garbage Out" GIGO! If you don't meta-tag your data properly you aren't fully enriching a data-retrieval process. How does anyone find it, you have all this great data that isn't being used.

That's what the Dublin Core embraces. If you ever notice DC.publisher in the meta-tags of an HTML document. That's Dublin Core. An initiative to embrace semantics in HTML markup. Dublin Core semantics can also be embedded into XMP, but the great thing about XMP is it allows for personalization of data archival with meta information. Using the Resource Description Framework (RDF) expressed as XML, serialized data can be stored with your digital assets. XMP aware applications such as Photoshop and Portfolio (It's what my company uses and what I'm trying to interact with) can categorize, search and even modify this XMP layer. Suddenly organizing your digital assets took on a whole new level. Metadata goes beyond organizing data into folders or sub-folders, it embeds an encyclopedia of information with the asset itself! No matter where you take that asset, that data will follow but of course, it's always important to also use data protection services to make sure your data is protected at all times. Every business can suffer an IT disaster at any time, so the best strategy is to always be prepared. You may reach out to an it disaster recovery company for IT strategy consulting before it’s too late.

Back to the subject of XMP in PHP. With Photoshop preferring XMP data over IPTC (naturally. Photoshop is, after all, an Adobe product), I need to be able to successfully manipulate the XMP data layer.

Also, Photoshop now uses XMP for it's primary metadata, meaning IPTC is only read by Photoshop if XMP is not present.
- PHP Community

The great thing about PHP and the open source community is that if you look hard enough, someone, somewhere has written something to tackle your immediate issue. Step-up one Evan Hunter, credit where credit is due. He has done just that in his PHP JPEG Metadata Toolkit, but don't let the title fool you, it works with other image formats as well.

A quick download later, and perusal of his code and it looks good. I'll let you know how I get on and post some updates. If anyone knows of some great PHP/XMP resources let me know!