Cast image metadata focal_length and shutter_speed to strings to restore previous behavior when stripslashes_deep() converted these values. Avoids rounding errors without making a determination of which digit we should round to. props jcakec. fixes #22259.

git-svn-id: https://develop.svn.wordpress.org/trunk@22319 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-10-28 16:17:56 +00:00
parent d29ca99ec1
commit cf3fe27ca0
1 changed files with 2 additions and 2 deletions

View File

@ -254,13 +254,13 @@ function wp_read_image_metadata( $file ) {
if ( ! empty($exif['DateTimeDigitized'] ) ) if ( ! empty($exif['DateTimeDigitized'] ) )
$meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized'] ); $meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized'] );
if ( ! empty($exif['FocalLength'] ) ) if ( ! empty($exif['FocalLength'] ) )
$meta['focal_length'] = wp_exif_frac2dec( $exif['FocalLength'] ); $meta['focal_length'] = (string) wp_exif_frac2dec( $exif['FocalLength'] );
if ( ! empty($exif['ISOSpeedRatings'] ) ) { if ( ! empty($exif['ISOSpeedRatings'] ) ) {
$meta['iso'] = is_array( $exif['ISOSpeedRatings'] ) ? reset( $exif['ISOSpeedRatings'] ) : $exif['ISOSpeedRatings']; $meta['iso'] = is_array( $exif['ISOSpeedRatings'] ) ? reset( $exif['ISOSpeedRatings'] ) : $exif['ISOSpeedRatings'];
$meta['iso'] = trim( $meta['iso'] ); $meta['iso'] = trim( $meta['iso'] );
} }
if ( ! empty($exif['ExposureTime'] ) ) if ( ! empty($exif['ExposureTime'] ) )
$meta['shutter_speed'] = wp_exif_frac2dec( $exif['ExposureTime'] ); $meta['shutter_speed'] = (string) wp_exif_frac2dec( $exif['ExposureTime'] );
} }
foreach ( array( 'title', 'caption', 'credit', 'copyright', 'camera', 'iso' ) as $key ) { foreach ( array( 'title', 'caption', 'credit', 'copyright', 'camera', 'iso' ) as $key ) {