Skip to content

Commit 5456c9c

Browse files
committed
XMP: x:xapmeta for older files
1 parent f4e90f8 commit 5456c9c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Metadata/XMP.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ protected function __construct (?string $data = null, bool $format = false) {
6464
}
6565

6666
public static function create (?string $data = null, bool $format = false) : XMP {
67+
//x:xmpmeta (or x:xapmeta for older files) element
68+
$data = preg_replace('~<x:xapmeta(.*)</x:xapmeta>~Uims', '<x:xmpmeta$1</x:xmpmeta>', $data);
69+
6770
return new static($data, $format);
6871
}
6972

@@ -74,7 +77,8 @@ public static function create (?string $data = null, bool $format = false) : XMP
7477
* @return null|XMP
7578
*/
7679
public static function readBlob (string $blob) : ?XMP {
77-
if (!preg_match('~<x:xmpmeta.*</x:xmpmeta>~Uims', $blob, $xmps)) {
80+
//x:xmpmeta (or x:xapmeta for older files) element
81+
if (!preg_match('~<x:xmpmeta.*</x:xmpmeta>|<x:xapmeta.*</x:xapmeta>~Uims', $blob, $xmps)) {
7882
return null;
7983
}
8084

0 commit comments

Comments
 (0)