Does php support webp image metadata?
Specifically, I want to be able to read and write XMP and EXIF metadata for webp images natively in php code.
I have been experimenting with the below code and it is giving me a "File not supported in" warning.
<?php
$photoSourceThumbnail = "publicAssets/images/att_galleryWebP/A0001_LSF-PHOTOS-WM-TM-WEBP/A0001-EWF-LSF-01.webp";
$photoSourceFull = "assets/images/att_galleryWebP/A0001_LSF-PHOTOS-WM-FULL-WEBP/A0001-EWF-LSF-01.webp";
echo "$photoSourceFull:<br />\n";
$exif = exif_read_data($photoSourceFull, 'IFD0');
echo $exif===false ? "No header data found.<br />\n" : "Image contains headers<br />\n";
$exif = exif_read_data($photoSourceFull, 0, true);
echo "test2.jpg:<br />\n";
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "$key.$name: $val<br />\n";
}
}
It is better to use ExifTool for this.
Install ExifTool
https://exiftool.org/
PHP example
Update: Exiftool added WebP support as of version 12.46, Oct. 1, 2022