• Resolved tonaras

    (@tonaras)


    Hi David,
    what an awesome plugin!!
    Everything works fine with jpgs. I’m having trouble though with extracting EXIF or XMP metadata from uploaded webp images.
    When checking the same images locally with Photoshop, Exiftool or Exiv2, they successfully extract the meta data.
    What could be the culprit here? Any help would be greatly appreciated!!
    Regards,
    Tony

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for the positive feedback and for your report. I would like to investigate further, but I haven’t found a WebP sample image with metadata embedded in it.

    Could you post a link to one or more of the images you are trying to process? Thanks for any help you can provide and for your interest in the plugin.

    Thread Starter tonaras

    (@tonaras)

    Thanks for the incredibly speedy reply! Sorry, it took me a while to get back to you as I wanted to finish some heavy investigating on this issue beforehand.

    In this github link you will find varius webp images with xpm/exif for testing purposes: https://github.com/drewnoakes/metadata-extractor-images/tree/master/webp

    I didn’t succeed in getting MLA to read ANY metadata in the webp images from that repo (although all other tools (Photoshop, Exiftool, WebPmux DO read the metadata of these images successfully).

    After A LOT of hacking, I successfully managed to get MLA to read xmp data that I injected into my own webp images via google’s webpmux.exe command line tool. The raw injected xmp data I used was:

    <x:xmpmeta xmlns:x=”adobe:ns:meta/” x:xmptk=”Adobe XMP Core 5.0-c060 61.134777, 2010/02/12-17:32:00 “>
    <rdf:RDF xmlns:rdf=”https://www.w3.org/1999/02/22-rdf-syntax-ns#”&gt;
    <rdf:Description rdf:about=””
    xmlns:xmp=”https://ns.adobe.com/xap/1.0/”&gt;
    <xmp:CreatorTool>iStation|eShopManager Windows – https://www.eshopmanager.gr</xmp:CreatorTool&gt;
    <xmp:CreateDate>2021-11-28T09:33:34+02:00</xmp:CreateDate>
    <xmp:ModifyDate>2022-03-03T18:08:37+02:00</xmp:ModifyDate>
    <xmp:MetadataDate>2022-03-03T18:08:37+02:00</xmp:MetadataDate>
    <xmp:MetadataTitle>[MetadataTitle]</xmp:MetadataTitle>
    <xmp:MetadataDescription>[MetadataDescription]</xmp:MetadataDescription>
    <xmp:MetadataAltText>[MetadataAltText]</xmp:MetadataAltText>
    <xmp:MetadataTitleL2>[MetadataTitleL2]</xmp:MetadataTitleL2>
    <xmp:MetadataDescriptionL2>[MetadataDescriptionL2]</xmp:MetadataDescriptionL2>
    <xmp:MetadataAltTextL2>[MetadataAltTextL2]</xmp:MetadataAltTextL2>
    <xmp:MetadataTitleL3>[MetadataTitleL3]</xmp:MetadataTitleL3>
    <xmp:MetadataDescriptionL3>[MetadataDescriptionL3]</xmp:MetadataDescriptionL3>
    <xmp:MetadataAltTextL3>[MetadataAltTextL3]</xmp:MetadataAltTextL3>
    </rdf:Description>
    </rdf:RDF>
    </x:xmpmeta>

    The data in square brackets such as [MetadataAltText] are just placeholders to be replaced by any UTF-8 string.

    You can download my sample webp image with these xmp metadata tags from https://eshopmanager.gr/uploads/book01.webp

    Please note, as I found out, custom xmp tags (as as <xmp:MetadataAltText>) need to be preceeded with the “Metadata” part before the “AltText”, otherwise the image will appear somehow corrupted (at least for Photoshop, which will throw an error when attempting to open the file that has, what it considers, wrong xmp tags and it. PS seems very picky about the xmp namespace).

    Meanwhile, I’m investigating on my end why xmp tags set via the Exiv2 tool in webp images don’t work with MLA.

    I hope this will help you make your AMAZING MLA even better by supporting webp images (which are getting realy essential).

    Please , let me know if I can be in any way further usefull for your endavor! I’d also highly appreciate if you can keep me up to date once you sort things out on this!

    Best regards,
    Tony

    Plugin Author David Lingren

    (@dglingren)

    Thanks for the link to your sample files and for all the diagnostic work you’ve done.

    My testing with the current MLA version reveals that it does indeed extract the XMP metadata from WebP image files, but because the data contains “invalid code points” (characters) the Media/Edit Media “Attachment File Metadata” text box is blank. You can use the xmp: prefix to access the data in a data substitution parameter.

    I have corrected the problem and could upload a new Development Version if you need it. The fix is quite simple and you can make the change yourself in the class-mla-edit-media.php file. Look for and replace the existing function with this update:

    	public static function mla_file_metadata_handler( $post ) {
    		$value = MLAData::mla_compose_attachment_metadata( $post->ID );
    		$value = apply_filters( 'mla_file_metadata_meta_box', array( 'value' => $value, 'rows' => 5, 'cols' => 80, 'flags' => ENT_SUBSTITUTE ), $post );
    
    		// Can't use esc_textarea( $value['value'] ) because the value might contain invalid code unit sequences
    		$html =  '<label class="screen-reader-text" for="mla_file_metadata">' . __( 'Attachment File Metadata', 'media-library-assistant' ) . '</label><textarea class="readonly" id="mla_file_metadata" rows="' . absint( $value['rows'] ) . '" cols="' . absint( $value['cols'] ) . '" readonly="readonly" name="mla_file_metadata" >' . htmlspecialchars( $value['value'], $value['flags'] ) . "</textarea>\n";
    		echo apply_filters( 'mla_file_metadata_meta_box_html', $html, $value, $post ); // phpcs:ignore
    	}
    

    If you need a complete Development Version, let me know.

    Note that MLA uses PHP functions to parse out IPTC and EXIF values. These do not support WebP files as of PHP v8.0.9. I don’t expect that to change.

    Thread Starter tonaras

    (@tonaras)

    Thanks for the update David! I really appreciate it!!

    I’ll try by replacing the function as you proposed. I’l let you know if I get stuck…

    I really don’t grasp why essential functions that were available in pre PHP 8+ suddenly aren’t available in PHP 8+ anymore. This PHP 8 business is more and more getting such a PIA on so many levels…

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update.

    You wrote “I really don’t grasp why essential functions that were available in pre PHP 8+ suddenly aren’t available in PHP 8+ anymore.” The IPTC and EXIF parsing functions are still available, but they have not been updated to incorporate changes in those standards over time. I developed my own code for the XMP parsing, and since the new data is usually available in the XMP values you can still use MLA to get at t.

    Regarding the “Attachment File Metadata” issue you discovered, I have uploaded a new MLA Development Version dated 20220309 that corrects the defect you reported. You can find step-by-step instructions for using the Development Version in this earlier topic:

    PHP Warning on media upload with Polylang

    Once the Development Version is installed you can have a look at the Media/Edit Media text box to see the WebP metadata. If you applied the change I posted earlier you do not need the new Development Version.

    This fix will be part of my next MLA version, but in the interim it would be great if you could let me know if it works for you. Thanks for alerting me to this MLA defect.

    Thread Starter tonaras

    (@tonaras)

    Hi David! Sorry for the late response, it’s been a busy week here.
    That’s phantastic really and I’m immensely grateful for your great support David.
    I’ll do some extensive testing with the Development Version and let you know what I find.
    Meanwhile, all the best to you!!

    Plugin Author David Lingren

    (@dglingren)

    I have released MLA version 3.00, which contains the fixes required for this topic.

    I am marking this topic resolved, but please update it if you have any problems or further questions regarding MLA’s support for extracting metadata from WebP images. Thanks for alerting me to this MLA defect.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘No metadata is extracted from WebP images’ is closed to new replies.