| 1 |
## XMPReader |
| 2 |
|
| 3 |
Reader for XMP data containing properties relevant to images, written in PHP. |
| 4 |
|
| 5 |
|
| 6 |
### Usage |
| 7 |
|
| 8 |
|
| 9 |
```php |
| 10 |
composer require wikimedia/xmp-reader |
| 11 |
``` |
| 12 |
|
| 13 |
```php |
| 14 |
use Wikimedia\XMPReader\Reader as XMPReader; |
| 15 |
|
| 16 |
//... |
| 17 |
|
| 18 |
// Check if the php instance has the required supported libraries to parse XMP |
| 19 |
$isXMPSupported = XMPReader::isSupported(); |
| 20 |
|
| 21 |
// Create a new instance |
| 22 |
$xmp = new XMPReader(); |
| 23 |
// or |
| 24 |
$xmp = new XMPReader( $logger, $filename ); |
| 25 |
// where $logger is an implementation of Psr\Log\LoggerInterface and $filename a string describing the origin of your XMP content |
| 26 |
|
| 27 |
// To parse XMP data in $string |
| 28 |
$xmp->parse( $string ); |
| 29 |
|
| 30 |
// To parse XMP Extended data in $string |
| 31 |
$xmp->parseExtended( $string ); |
| 32 |
|
| 33 |
// To retrieve the parsed results |
| 34 |
$results = $xmp->getResults(); |
| 35 |
``` |
| 36 |
|
| 37 |
The parsed results are returned in an array of 3 potential groups, |
| 38 |
which indicate their priority according to the Metadata Working Group guidance. |
| 39 |
http://www.metadataworkinggroup.org/pdf/mwg_guidance.pdf |
| 40 |
|
| 41 |
```php |
| 42 |
[ |
| 43 |
'xmp-exif' => [], |
| 44 |
'xmp-general' => [], |
| 45 |
'xmp-deprecated' => [], |
| 46 |
] |
| 47 |
``` |
| 48 |
|
| 49 |
### Supported XMP |
| 50 |
Most of the following metadata sets are supported |
| 51 |
* http://ns.adobe.com/exif/1.0/ |
| 52 |
* http://ns.adobe.com/tiff/1.0/ |
| 53 |
* http://ns.adobe.com/exif/1.0/aux/ |
| 54 |
* http://purl.org/dc/elements/1.1/ |
| 55 |
* http://ns.adobe.com/xap/1.0/rights/ |
| 56 |
* http://creativecommons.org/ns# |
| 57 |
* http://ns.adobe.com/xmp/note/ |
| 58 |
|
| 59 |
Some of: |
| 60 |
* http://ns.adobe.com/xap/1.0/ |
| 61 |
* http://ns.adobe.com/xap/1.0/mm/ |
| 62 |
* http://ns.adobe.com/photoshop/1.0/ |
| 63 |
* http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/ |
| 64 |
* http://iptc.org/std/Iptc4xmpExt/2008-02-29/ |
| 65 |
|
| 66 |
## License |
| 67 |
GNU General Public License v2.0 |