diff --git a/issue25/README.md b/issue25/README.md new file mode 100644 index 0000000..9e9e1f9 --- /dev/null +++ b/issue25/README.md @@ -0,0 +1,44 @@ +Attempt at reproducing https://github.com/Frameright/php-image-metadata-parser/issues/25 + +### Quickly run my attempt + +Make sure you have PHP interpreter and Composer installed on your system: + +```bash +php --version +composer --version +``` + +Then run the following commands: + +```bash +# Clone my attempt at reproducing the issue +git clone https://github.com/Frameright/php-image-metadata-parser +cd php-image-metadata-parser/issue25 + +# Install the latest version of the PHP library +composer require frameright/image-metadata-parser + +# Run this simple PHP script (see details below about what it does) +./image-metadata-parser.php +``` + +This PHP script doesn't do much. It just loads the image file and prints out XMP metadata: + +``` +#!/usr/bin/env php +getXmp(); + +// nicely format output with indentation and extra space: +$xmp_metadata->setFormatOutput(true); + +print_r($xmp_metadata->getString()); +``` diff --git a/issue25/composer.json b/issue25/composer.json new file mode 100644 index 0000000..60e8c8c --- /dev/null +++ b/issue25/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "frameright/image-metadata-parser": "^1.1" + } +} diff --git a/issue25/composer.lock b/issue25/composer.lock new file mode 100644 index 0000000..bdf49e9 --- /dev/null +++ b/issue25/composer.lock @@ -0,0 +1,90 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "1803d12d7122d58aea50cf77568c007b", + "packages": [ + { + "name": "frameright/image-metadata-parser", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/Frameright/php-image-metadata-parser.git", + "reference": "8ac64a7ef79d5abb099f35fabf01aa2417df7a0b" + }, + "dist": { + "type": "zip", + "url": "https://github.com/gitapi/repos/Frameright/php-image-metadata-parser/zipball/8ac64a7ef79d5abb099f35fabf01aa2417df7a0b", + "reference": "8ac64a7ef79d5abb099f35fabf01aa2417df7a0b", + "shasum": "" + }, + "require": { + "ext-xml": "*", + "php": ">=5.5" + }, + "require-dev": { + "mockery/mockery": "~1.6", + "phpcompatibility/php-compatibility": "^9.3.5", + "phpunit/phpunit": "^9.5.25" + }, + "type": "library", + "autoload": { + "psr-4": { + "CSD\\Image\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frameright (Coberg Ltd)", + "email": "hello@frameright.io", + "homepage": "https://frameright.io/", + "role": "Developer" + }, + { + "name": "Aurelien Lourot", + "email": "software@lourot.dev", + "homepage": "https://lourot.dev/", + "role": "Developer" + }, + { + "name": "Daniel Chesterton", + "email": "daniel@chestertondevelopment.com", + "homepage": "http://www.chestertondevelopment.com", + "role": "Developer" + } + ], + "description": "Image metadata parsing library", + "keywords": [ + "Frameright", + "IDC", + "IPTC", + "Image Display Control", + "exif", + "image", + "metadata", + "photo", + "xmp" + ], + "support": { + "issues": "https://github.com/Frameright/php-image-metadata-parser/issues", + "source": "https://github.com/Frameright/php-image-metadata-parser/tree/1.1.1" + }, + "time": "2024-02-01T17:47:46+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.3.0" +} diff --git a/issue25/exiftool.sh b/issue25/exiftool.sh new file mode 100755 index 0000000..af28842 --- /dev/null +++ b/issue25/exiftool.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# exiftool -XMP -b reproducer.jpg | xmlstarlet fo > exiftool_output.xml +exiftool -XMP -b frameright.jpg | xmlstarlet fo > exiftool_output_good.xml diff --git a/issue25/exiftool_output.xml b/issue25/exiftool_output.xml new file mode 100644 index 0000000..555b2a6 --- /dev/null +++ b/issue25/exiftool_output.xml @@ -0,0 +1,314 @@ + + + + + + 1381031758 + 95yWeO3K9FRUOZUV93Ok9g== + 2 + 2024-04-09T10:47:51.852Z + 2024-04-09T10:47:51.852Z + + + FRA + + + + + Christine Centenera + + + + + + + + + + Edward Berthelot + + + + + PARIS, FRANCE - MARCH 05: Christine Centenera wears a blue with white embroidered pattern cap from Balenciaga, black sunglasses, a white t-shirt, a beige long / belted with shoulder-pads coat, black shiny leather pointed / heels knees boots / high boots, a gold ring, outside Vivienne Westwood , during Paris Fashion Week - Womenswear F/W 2022-2023, on March 05, 2022 in Paris, France. (Photo by Edward Berthelot/Getty Images) + + + image/jpeg + + + 2022 Edward Berthelot + + + Getty Images Europe + + + apple + burgundy lipstick + elegant + fashion blogger + fashion outfit + ginger hair + long hiar + outfit + paris + ready-to-wear + rtw + smartphone + spring outfit + style + woman + + + + + 1381031758 + + + + + 8Mw0Nija4T38Sf6nY6lt-a + + + Edward Berthelot + 2022 Edward Berthelot + Edward Berthelot + woman + + + Contributor + XX / XX + E + Paris + true + France + Getty Images + 2022-03-05T00:00:00+00:00 + Street Style : Day Six - Paris Fashion Week - Womenswear F/W 2022-2023 + Not Released (NR) + Getty Images Europe + + + CEL + + + CEL + 775778623 + https://www.gettyimages.com + 2 + + + + + + https://www.gettyimages.com/eula?utm_medium=organic&utm_source=google&utm_campaign=iptcurl + + + + https://www.gettyimages.com/eula?utm_medium=organic&utm_source=google&utm_campaign=iptcurl + + + 2022 Edward Berthelot + + + apple + burgundy lipstick + elegant + fashion blogger + fashion outfit + ginger hair + long hiar + outfit + paris + ready-to-wear + rtw + smartphone + spring outfit + style + woman + + + + + + + 2022 Edward Berthelot + + + + + Getty Images + + + + + + + 2022 Edward Berthelot + + + + + Edward Berthelot + 0 + + + xmp.did:e1c022c1-dfca-47cf-8c93-1f80457ddb53 + xmp.iid:e1c022c1-dfca-47cf-8c93-1f80457ddb53 + xmp.did:e1c022c1-dfca-47cf-8c93-1f80457ddb53 + + + https://www.gettyimages.com/eula?utm_medium=organic&utm_source=google&utm_campaign=iptcurl + + + + + + + rectangle + relative + 0.7179294823705926 + 0.4785 + 0.11890472618154539 + 0.13225 + + crop-0fd40a5b-ad5f-4b29-9ab2-43afc21b44a6 + + + + + + http://cv.iptc.org/newscodes/imageregionrole/cropping + + + + + + definition-0dae7c70-f936-49ad-80d2-a9f0f6c0fcdb + 1:1 Square (Common sizes) + + + + rectangle + relative + 0.8162040510127532 + 0.306 + 0.0967741935483871 + 0.16025 + + crop-4c732f66-2884-4fb2-86ae-2fcc332349ae + + + + + + http://cv.iptc.org/newscodes/imageregionrole/cropping + + + + + + definition-05f3431c-1a7f-41eb-b457-1303852d5d58 + 16:9 Horizontal (Common sizes) + + + + rectangle + relative + 0.8447111777944486 + 0.42225 + 0.08289572393098274 + 0.1405 + + crop-96109636-028d-455c-ac90-c0c9d1287965 + + + + + + http://cv.iptc.org/newscodes/imageregionrole/cropping + + + + + + definition-11d4029f-76b6-4578-8983-2ef9312ed3e5 + 4:3 Horizontal + + + + rectangle + relative + 0.6882970742685671 + 0.81575 + 0.1436609152288072 + 0.11375 + + crop-6198987b-009b-499d-97fb-8cbad064a4e4 + + + + + + http://cv.iptc.org/newscodes/imageregionrole/cropping + + + + + + definition-1874ebf6-95a0-485c-b72b-8c910f222df6 + 9:16 Vertical (Common sizes) + + + + rectangle + relative + 0.9167291822955739 + 0.8145 + 0.041635408852213056 + 0.11375 + + crop-7802d940-6da5-424a-909b-148421ebaf40 + + + + + + http://cv.iptc.org/newscodes/imageregionrole/cropping + + + + + + definition-4db1a2b6-6a55-469f-b743-46d3483a504b + 3:4 Vertical + + + + rectangle + relative + 0.822205551387847 + 0.287 + 0.09152288072018004 + 0.15675 + + crop-b9385090-7c1e-4125-81d0-7837af4eb4cd + + + + + + http://cv.iptc.org/newscodes/imageregionrole/cropping + + + + + + definition-3f94b28f-341a-4b17-871a-0543a03a6bbc + Shared Link (Facebook) + + + + + + + diff --git a/issue25/exiftool_output_good.xml b/issue25/exiftool_output_good.xml new file mode 100644 index 0000000..39aeeec --- /dev/null +++ b/issue25/exiftool_output_good.xml @@ -0,0 +1,39 @@ + + + + + + + + + + rectangle + relative + 0.8890625 + 1 + 0.0375 + 0 + + crop-e789b6b8-ee15-45c0-a0c5-3ad38858db14 + + + + + + http://cv.iptc.org/newscodes/imageregionrole/cropping + + + + + + definition-7a54f275-6872-435e-befc-b52d97653a28 + 4:3 Horizontal + + + + 2023-10-08T06:53:22.336Z + 2023-10-08T06:53:22.336Z + + + + diff --git a/issue25/frameright.jpg b/issue25/frameright.jpg new file mode 100644 index 0000000..a4a81b4 Binary files /dev/null and b/issue25/frameright.jpg differ diff --git a/issue25/image-metadata-parser.php b/issue25/image-metadata-parser.php new file mode 100755 index 0000000..6da791a --- /dev/null +++ b/issue25/image-metadata-parser.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +getXmp(); + +// nicely format output with indentation and extra space: +$xmp_metadata->setFormatOutput(true); + +// print all the XML metadata: +print_r($xmp_metadata->getString()); + +// extract the image regions specifically: +$regions = $xmp_metadata->getImageRegions(); +print_r($regions); diff --git a/issue25/image-metadata-parser.sh b/issue25/image-metadata-parser.sh new file mode 100755 index 0000000..ff24512 --- /dev/null +++ b/issue25/image-metadata-parser.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -xe + +composer require frameright/image-metadata-parser +./image-metadata-parser.php diff --git a/issue25/reproducer.jpg b/issue25/reproducer.jpg new file mode 100644 index 0000000..0153f66 Binary files /dev/null and b/issue25/reproducer.jpg differ