diff --git src/wp-admin/includes/image.php src/wp-admin/includes/image.php
index 222d35d..c21c520 100644
|
|
function wp_read_image_metadata( $file ) { |
277 | 277 | 'shutter_speed' => 0, |
278 | 278 | 'title' => '', |
279 | 279 | 'orientation' => 0, |
| 280 | 'keywords' => array(), |
280 | 281 | ); |
281 | 282 | |
282 | 283 | /* |
… |
… |
function wp_read_image_metadata( $file ) { |
325 | 326 | |
326 | 327 | if ( ! empty( $iptc['2#116'][0] ) ) // copyright |
327 | 328 | $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 | } |
328 | 333 | } |
329 | 334 | } |
330 | 335 | |
… |
… |
function wp_read_image_metadata( $file ) { |
410 | 415 | * Filter the array of meta data read from an image's exif data. |
411 | 416 | * |
412 | 417 | * @since 2.5.0 |
| 418 | * @since 4.4.0 The `$iptc` parameter was added. |
413 | 419 | * |
414 | 420 | * @param array $meta Image meta data. |
415 | 421 | * @param string $file Path to image file. |
416 | 422 | * @param int $sourceImageType Type of image. |
| 423 | * @param array $iptc IPTC data. |
417 | 424 | */ |
418 | | return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType ); |
| 425 | return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType, $iptc ); |
419 | 426 | |
420 | 427 | } |
421 | 428 | |
diff --git tests/phpunit/data/images/33772.jpg tests/phpunit/data/images/33772.jpg
new file mode 100644
index 0000000..1f6002b
Binary files /dev/null and tests/phpunit/data/images/33772.jpg differ
diff --git tests/phpunit/tests/image/meta.php tests/phpunit/tests/image/meta.php
index 0738f55..88107dd 100644
|
|
class Tests_Image_Meta extends WP_UnitTestCase { |
138 | 138 | $out = wp_read_image_metadata(DIR_TESTDATA.'/images/404_image.png'); |
139 | 139 | $this->assertFalse($out); |
140 | 140 | } |
| 141 | |
| 142 | |
| 143 | /** |
| 144 | * @ticket 33772 |
| 145 | */ |
| 146 | public function test_exif_keywords() { |
| 147 | $out = wp_read_image_metadata(DIR_TESTDATA.'/images/33772.jpg'); |
| 148 | |
| 149 | $this->assertEquals('8', $out['aperture']); |
| 150 | $this->assertEquals('Photoshop Author', $out['credit']); |
| 151 | $this->assertEquals('DMC-LX2', $out['camera']); |
| 152 | $this->assertEquals('Photoshop Description', $out['caption']); |
| 153 | $this->assertEquals(1306315327, $out['created_timestamp']); |
| 154 | $this->assertEquals('Photoshop Copyrright Notice', $out['copyright']); |
| 155 | $this->assertEquals('6.3', $out['focal_length']); |
| 156 | $this->assertEquals('100', $out['iso']); |
| 157 | $this->assertEquals('0.0025', $out['shutter_speed']); |
| 158 | $this->assertEquals('Photoshop Document Ttitle', $out['title']); |
| 159 | $this->assertEquals(1, $out['orientation']); |
| 160 | $this->assertEquals(array('beach', 'baywatch', 'LA', 'sunset'), $out['keywords']); |
| 161 | } |
| 162 | |
141 | 163 | } |