Ticket #5397: 5397.exif.the-proper-way.diff
File 5397.exif.the-proper-way.diff, 1.7 KB (added by , 16 years ago) |
---|
-
wp-admin/includes/image.php
250 250 if ( !file_exists( $file ) ) 251 251 return false; 252 252 253 list(,,$sourceImageType) = getimagesize( $file ); 254 253 255 // exif contains a bunch of data we'll probably never need formatted in ways that are difficult to use. 254 256 // We'll normalize it and just extract the fields that are likely to be useful. Fractions and numbers 255 257 // are converted to floats, dates to unix timestamps, and everything else to strings. … … 287 289 } 288 290 289 291 // fetch additional info from exif if available 290 if ( is_callable('exif_read_data') ) {292 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)) ) ) { 291 293 $exif = exif_read_data( $file ); 292 294 if (!empty($exif['FNumber'])) 293 295 $meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 ); … … 304 306 } 305 307 // FIXME: try other exif libraries if available 306 308 307 return apply_filters( 'wp_read_image_metadata', $meta, $file );309 return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType ); 308 310 309 311 } 310 312 -
wp-includes/compat.php
157 157 if (!defined('IMAGETYPE_PNG')) 158 158 define('IMAGETYPE_PNG', 3); 159 159 160 if (!defined('IMAGETYPE_TIFF_MM')) 161 define('IMAGETYPE_TIFF_MM',7); 160 162 163 if (!defined('IMAGETYPE_TIFF_MM')) 164 define('IMAGETYPE_TIFF_MM',8); 165 161 166 ?>