Make WordPress Core


Ignore:
Timestamp:
09/22/2015 04:18:02 AM (9 years ago)
Author:
wonderboymusic
Message:

Media: In wp_read_image_metadata(), include IPTC Keywords when available in $meta.

Adds unit test.

Props swissspidy, dbru, SteveHoneyNZ.
Fixes #33772.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/image.php

    r34007 r34374  
    278278        'title' => '',
    279279        'orientation' => 0,
     280        'keywords' => array(),
    280281    );
    281282
     
    326327            if ( ! empty( $iptc['2#116'][0] ) ) // copyright
    327328                $meta['copyright'] = trim( $iptc['2#116'][0] );
     329
     330            if ( ! empty( $iptc['2#025'][0] ) ) { // keywords array
     331                $meta['keywords'] = array_values( $iptc['2#025'] );
     332            }
    328333         }
    329334    }
     
    411416     *
    412417     * @since 2.5.0
     418     * @since 4.4.0 The `$iptc` parameter was added.
    413419     *
    414420     * @param array  $meta            Image meta data.
    415421     * @param string $file            Path to image file.
    416422     * @param int    $sourceImageType Type of image.
    417      */
    418     return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType );
     423     * @param array  $iptc            IPTC data.
     424     */
     425    return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType, $iptc );
    419426
    420427}
Note: See TracChangeset for help on using the changeset viewer.