Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#33771 closed enhancement (duplicate)

Include IPTC Keywords in image_metadata array

Reported by: stevehoneynz's profile SteveHoneyNZ Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Media Keywords:
Focuses: Cc:


IPTC data is already parsed in the attachment metadata process, and use of IPTC keywords is often requested, and there are a number of plugin solutions for using keywords and other IPTC meta.

In core currently the comments around IPTC note that it's selecting only values considered to be "useful" and consistently avaialable. As Adobe and others have almost universally adopted IPTC tag 2#025 as containing keywords it would be useful for developers to have access to these in the image_meta array of attachment_metadata.

The attached demonstrates a small addition to the wp_read_image_metadata function which adds the keywords as a non-indexed array.

Possible negatives - the array values should potentially be escaped/sanitized (I'm unsure what the iptc parse function already does in this respect). Also as attachment_metadata is one serialized db entry images with exceptionally large amonuts of keywords added may become bloated, possibly limit to say 99 by trimming array.

As an example use case I was working on a plugin that bulk creates WooCommerce products from images for print/digital sales, I wanted to add the keywords as product tags for search purposes. With this addition I was able to accomplish that.

Change History (1)

#1 @swissspidy
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #33772.

Note: See TracTickets for help on using tickets.