Changeset 40403
- Timestamp:
- 04/10/2017 02:27:23 PM (8 years ago)
- Location:
- branches/4.7
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.7
-
branches/4.7/src/wp-includes/functions.php
r40134 r40403 2367 2367 try { 2368 2368 if ( is_callable( 'exif_imagetype' ) ) { 2369 $mime = image_type_to_mime_type( exif_imagetype( $file ) ); 2369 $imagetype = exif_imagetype( $file ); 2370 $mime = ( $imagetype ) ? image_type_to_mime_type( $imagetype ) : false; 2370 2371 } elseif ( function_exists( 'getimagesize' ) ) { 2371 2372 $imagesize = getimagesize( $file ); -
branches/4.7/tests/phpunit/tests/functions.php
r40134 r40403 901 901 902 902 /** 903 * @ticket 40017 904 * @dataProvider _wp_get_image_mime 905 */ 906 public function test_wp_get_image_mime( $file, $expected ) { 907 if ( ! is_callable( 'exif_imagetype' ) && ! function_exists( 'getimagesize' ) ) { 908 $this->markTestSkipped( 'The exif PHP extension is not loaded.' ); 909 } 910 911 $this->assertEquals( $expected, wp_get_image_mime( $file ) ); 912 } 913 914 /** 903 915 * @ticket 39550 904 916 * @dataProvider _wp_check_filetype_and_ext_data … … 976 988 $mimes['woff'] = 'application/font-woff'; 977 989 return $mimes; 990 } 991 992 /** 993 * Data profider for test_wp_get_image_mime(); 994 */ 995 public function _wp_get_image_mime() { 996 $data = array( 997 // Standard JPEG. 998 array( 999 DIR_TESTDATA . '/images/test-image.jpg', 1000 'image/jpeg', 1001 ), 1002 // Standard GIF. 1003 array( 1004 DIR_TESTDATA . '/images/test-image.gif', 1005 'image/gif', 1006 ), 1007 // Standard PNG. 1008 array( 1009 DIR_TESTDATA . '/images/test-image.png', 1010 'image/png', 1011 ), 1012 // Image with wrong extension. 1013 array( 1014 DIR_TESTDATA . '/images/test-image-mime-jpg.png', 1015 'image/jpeg', 1016 ), 1017 // Not an image. 1018 array( 1019 DIR_TESTDATA . '/uploads/dashicons.woff', 1020 false, 1021 ), 1022 ); 1023 1024 return $data; 978 1025 } 979 1026
Note: See TracChangeset
for help on using the changeset viewer.