Ticket #39552: functions.php.patch
File functions.php.patch, 1.2 KB (added by , 8 years ago) |
---|
-
wp-includes/functions.php
2366 2366 */ 2367 2367 try { 2368 2368 if ( is_callable( 'exif_imagetype' ) ) { 2369 $mime = image_type_to_mime_type( exif_imagetype( $file ) ); 2369 $mime = exif_imagetype( $file ); 2370 // avoid falling back to application/octet-stream when exif_imagetype returns false 2371 if( $mime !== false ) { 2372 $mime = image_type_to_mime_type( $mime ); 2373 } 2370 2374 } elseif ( function_exists( 'getimagesize' ) ) { 2371 2375 $imagesize = getimagesize( $file ); 2372 2376 $mime = ( isset( $imagesize['mime'] ) ) ? $imagesize['mime'] : false; … … 2373 2377 } else { 2374 2378 $mime = false; 2375 2379 } 2380 if( $mime === false && function_exists ( 'finfo_file' ) ){ 2381 /* if the mime type is false image file not supported by PHP Constants (this applies at least to 2382 * svg, but might apply to other file types) To fix this, use finfo to determine the mimetype instead 2383 */ 2384 $finfo = finfo_open( FILEINFO_MIME_TYPE ); 2385 $mime = finfo_file( $finfo, $file ); 2386 finfo_close( $finfo ); 2387 } 2376 2388 } catch ( Exception $e ) { 2377 2389 $mime = false; 2378 2390 }