Make WordPress Core

Ticket #33772: 33772.diff

File 33772.diff, 2.8 KB (added by dbru, 10 years ago)
  • src/wp-admin/includes/image.php

     
    277277                'shutter_speed' => 0,
    278278                'title' => '',
    279279                'orientation' => 0,
     280                'keywords' => array(),
    280281        );
    281282
    282283        /*
     
    325326
    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        }
    330335
     
    414419         * @param array  $meta            Image meta data.
    415420         * @param string $file            Path to image file.
    416421         * @param int    $sourceImageType Type of image.
     422         * @param array  $iptc            IPTC data.
    417423         */
    418         return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType );
     424        return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType, $iptc );
    419425
    420426}
    421427
  • tests/phpunit/data/images/33772.jpg

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
  • tests/phpunit/tests/image/meta.php

    Property changes on: tests/phpunit/data/images/33772.jpg
    ___________________________________________________________________
    Added: svn:mime-type
    ## -0,0 +1 ##
    +application/octet-stream
    \ No newline at end of property
     
    138138                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/404_image.png');
    139139                $this->assertFalse($out);
    140140        }
     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        }
     163
    141164}