• Resolved Steve McNally

    (@stevemcnally)


    wp media import "/path/to/image.png" --skip-copy

    imports items to the Media Library without adding or moving source image files in uploads/. But skipping the image file copy also skips MLA’s mla_upload_prefilter hook and IPTC/EXIF Mapping Actions. The Attachment File Metadata is not added to the imported media item record so the Standard field mapping Rules don’t work.

    How would you recommend calling mla_upload_prefilter when using this media import method?

    The MLA Metadata Mapping Hooks Example and MLA CSV Data Source Example plugins have related features I’m reviewing, too.

    wp-cli media import

    • This topic was modified 2 years, 3 months ago by Steve McNally.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for an interesting question. The mla_upload_prefilter is designed to let other code modify the image metadata; it doesn’t do anything on its own.

    There are two small example plugins that show you how to accomplish something similar to your goal:

    • MLA Bulk Edit Remap Example – Performs IPTC/EXIF and Custom Field mapping at the conclusion of a Bulk Edit action, so data sources like “terms:” are properly applied.
    • MLA Postie Post After Example – Applies MLA mapping rules to child attachments after Postie creates a parent post from an email.

    You should be able to adapt the ideas there to your application. I’m not sure if the MLAOptions class is loaded for wp-cli operations. If that’s a problem, let me know.

    I will leave this topic unresolved in case you have problems or further questions regarding the code in the example plugins.

    • This reply was modified 2 years, 3 months ago by David Lingren.
    Thread Starter Steve McNally

    (@stevemcnally)

    Many thanks, David. Checking this out and will report back on MLA Bulk Edit Remap Example, MLA Postie Post After Example, and any other details of interest.

    Thread Starter Steve McNally

    (@stevemcnally)

    Everything works as designed with **MLA** and Standard field mapping **Rules** using

    wp media import "/path/to/file.png" --skip-copy

    We can close this topic. Absolutely brilliant on WordPress’, wp-cli’s and MLA’s part –

    I needed a mount point[0] in wp-content/uploads/ that WP can read. Everything else Just Works from there. This is Good.

    [0] absolute local fs paths, symlinks, virtual filesystems, and tunnels haven’t worked yet, but I’m sure they would with more cajoling.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the good news regarding a solution for the problem.

    I am marking this topic resolved, but please update it if you have anything to add or ask.

    Thread Starter Steve McNally

    (@stevemcnally)

    Thanks again, David. MLA “just working” with --skip-copy opens tons of options.

    The powerful search surfaces media regardless of where the terms live within the imported item. Referencing the source asset — rather than a new copy in WordPress — means updates to the source’s metadata is reflected immediately and available to Standard field mapping Rules.

    exiftool is one way to update source metadata. Adobe, Apple and others offer tons more ways. So long as WordPress can read the source asset as “local,” it’s usable anywhere media can be used + all the enrichment MLA adds. Very cool –

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘“IPTC/EXIF Mapping Actions” during wp-cli “–skip-copy” import’ is closed to new replies.