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: http://core.svn.wordpress.org/trunk@22319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-10-28 16:17:56 +00:00
parent 4dfaa3fd73
commit f965ff1c84

View File

@ -254,13 +254,13 @@ function wp_read_image_metadata( $file ) {
if ( ! empty($exif['DateTimeDigitized'] ) )
$meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized'] );
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'] ) ) {
$meta['iso'] = is_array( $exif['ISOSpeedRatings'] ) ? reset( $exif['ISOSpeedRatings'] ) : $exif['ISOSpeedRatings'];
$meta['iso'] = trim( $meta['iso'] );
}
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 ) {