Open klaari opened 5 months ago
Hi @klaari, sorry about that and thanks for the detailed issue. Let me have a look later today and get back to you.
I can reproduce:
$image = Image::fromFile('reproducer.jpg');
$xmp_metadata = $image->getXmp(); // I can see all the image regions, but...
$regions = $xmp_metadata->getImageRegions();
print_r($regions); // prints an empty array
Investigating...
This image contains two occurrences of <rdf:Description xmlns:Iptc4xmpExt ...
and the regions are in the second one. The current PHP metadata parser didn't expect there might be several rdf:Description
elements and looks only in the first one.
This is quite easy to fix, i.e. to extend the parser not to assume there will be only one rdf:Description
but to iterate over all of them when looking for Iptc4xmpExt:*
data. I'm writing the fix now.
@klaari can I use your image as a test fixture in order to write a unit test covering images with several rdf:Description
elements? I would mention here that you own this image.
FYI the fix and the test are ready, pushed in a temporary branch: https://github.com/Frameright/php-image-metadata-parser/commit/7acf46cc54
As soon as I get green light from you about using your image as a test fixture, I'll push this to the main branch and release a new version. Thanks a lot for the detailed issue, which made it very easy for us to reproduce and investigate :pray:
Thanks for the quick reply and fix @lourot !
I'm sorry, but I do not own the image, and it appears that the license does not allow its use :/
@klaari No worries, thank you for your patience and apologies for any inconvenience :)
@lourot Great work! Let me see if during the weekend I could recreate an image file with a similar metadata setup, which we could use as a fixture instead.
Alright, no problem. What about I comment out the test for now, remove the image, and publish a new version already now to unblock @klaari ? Then we can enable the test whenever we have such an image.
@lourot Sounds good, let's do so.
1.1.2
published:
Let us know if that works for you or if you're still bumping into issues @klaari :pray:
Keeping this issue open until we have re-enabled the test.
Thank you @lourot for the super fast delivery!
I'm not able to read image regions from this specific image: [removed]
Seems like a conflict with metadata from other tools.
If I delete all metadata (with exiftool -all= -overwrite_original) and create the regions again with Frameright app everything works fine. Also reading the original image with your typescript library works fine.
How to reproduce:
exiftool shows that the regions exists in the metadata: