diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index eb6676d6f..5b08eef02 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -250,6 +250,8 @@ function wp_read_image_metadata( $file ) { if ( !file_exists( $file ) ) return false; + list(,,$sourceImageType) = getimagesize( $file ); + // exif contains a bunch of data we'll probably never need formatted in ways that are difficult to use. // We'll normalize it and just extract the fields that are likely to be useful. Fractions and numbers // are converted to floats, dates to unix timestamps, and everything else to strings. @@ -287,7 +289,7 @@ function wp_read_image_metadata( $file ) { } // fetch additional info from exif if available - if ( is_callable('exif_read_data') ) { + if ( is_callable('exif_read_data') && in_array($sourceImageType, apply_filters('wp_read_image_metadata_types', array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM)) ) ) { $exif = exif_read_data( $file ); if (!empty($exif['FNumber'])) $meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 ); @@ -304,7 +306,7 @@ function wp_read_image_metadata( $file ) { } // FIXME: try other exif libraries if available - return apply_filters( 'wp_read_image_metadata', $meta, $file ); + return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType ); } diff --git a/wp-includes/compat.php b/wp-includes/compat.php index 88d1751e7..90d87bc15 100644 --- a/wp-includes/compat.php +++ b/wp-includes/compat.php @@ -178,5 +178,10 @@ if (!defined('IMAGETYPE_JPEG')) if (!defined('IMAGETYPE_PNG')) define('IMAGETYPE_PNG', 3); +if (!defined('IMAGETYPE_TIFF_MM')) + define('IMAGETYPE_TIFF_MM',7); + +if (!defined('IMAGETYPE_TIFF_MM')) + define('IMAGETYPE_TIFF_MM',8); ?>