Keywords: JPEG Metadata Application Segments APP0 APP1 APP2 APP3 APP12 APP13 APP14 EXIF DCF XMP RDF Photoshop IRB IPTC DCMI JFIF

# The PHP JPEG Metadata Toolkit - Documentation

Go to Documentation - Home

## XMP / RDF / Dublin Core Function Reference

The Extensible Metadata Platform (XMP) information resides in the "App 1" segment of a JPEG image. An XMP segment is XML based and contains Resource Description Framework (RDF) data, which itself can contain the Dublin Core Metadata Initiative (DCMI) information.

Function: | get_XMP_text
Description: | Retrieves the Extensible Metadata Platform (XMP) information from an App1 JPEG segment and returns the raw XML text as a string. This includes the Resource Description Framework (RDF) information and may include Dublin Core Metadata Initiative (DCMI) information. Uses information supplied by the get_jpeg_header_data function
Parameters: | jpeg_header_data | a JPEG header data array in the same format as from get_jpeg_header_data
Returns: | xmp_data | the string of raw XML text
FALSE | if an APP 1 XMP segment could not be found, or if an error occured

Function: | put_XMP_text
Description: | Adds or modifies the Extensible Metadata Platform (XMP) information in an App1 JPEG segment. If a XMP segment already exists, it is replaced, otherwise a new one is inserted, using the supplied data. Uses information supplied by the get_jpeg_header_data function
Parameters: | jpeg_header_data | a JPEG header data array in the same format as from get_jpeg_header_data
newXMP | a string containing the XMP text to be stored in the XMP segment. Should be constructed using the write_XMP_array_to_text function
Returns: | jpeg_header_data | the JPEG header data array with the XMP segment added.
FALSE | if an error occured

Function: | read_XMP_array_from_text
Description: | An alias for read_xml_array_from_text. Parses a string containing XMP data (XML), and returns the resulting tree structure array, which contains all the XMP (XML) information. Note: White space and comments in the XMP data (XML) are ignored Note: All text information contained in the tree structure is encoded as Unicode UTF-8. Hence text will appear as normal ASCII except where there is an extended character.
Parameters: | xmptext | a string containing the XMP data (XML) to be parsed
Returns: | output | the tree structure array containing the XMP (XML) information
FALSE | if an error occured

Function: | write_XMP_array_to_text
Description: | Takes a tree structure array containing XMP (in the same format as returned by read_XMP_array_from_text, and constructs a string containing the equivalent XMP, including the XMP Packet header and trailer. Produces XMP text which has correct indents, encoded using UTF-8. Note: All text information contained in the tree structure can be either 7-bit ASCII or encoded as Unicode UTF-8, since UTF-8 passes 7-bit ASCII text unchanged.
Parameters: | xmparray | the tree structure array containing the information to be converted to XMP text
Returns: | output_XMP_text | the string containing the equivalent XMP text

Function: | Interpret_XMP_to_HTML
Description: | Generates html showing the information contained in an Extensible Metadata Platform (XMP) tree structure array, as retrieved with read_XMP_array_from_text
Parameters: | XMP_array | a XMP tree structure array as from read_XMP_array_from_text
Returns: | output | the HTML string