Use utf8_encode() consistently in wp_read_image_metadata(). Also add some whitespace. props miqrogroove, see #11417, see #12095

git-svn-id: http://svn.automattic.com/wordpress/trunk@13249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-02-20 12:09:30 +00:00
parent 804af64f88
commit 39605976b1
1 changed files with 28 additions and 26 deletions

View File

@ -256,9 +256,11 @@ function wp_read_image_metadata( $file ) {
if ( ! empty( $info['APP13'] ) ) {
$iptc = iptcparse( $info['APP13'] );
if ( ! empty($iptc['2#105'][0] ) ) // headline, "A brief synopsis of the caption."
// headline, "A brief synopsis of the caption."
if ( ! empty( $iptc['2#105'][0] ) )
$meta['title'] = utf8_encode( trim( $iptc['2#105'][0] ) );
elseif ( !empty($iptc['2#005'][0]) ) // title, "Many use the Title field to store the filename of the image, though the field may be used in many ways."
// title, "Many use the Title field to store the filename of the image, though the field may be used in many ways."
elseif ( ! empty( $iptc['2#005'][0] ) )
$meta['title'] = utf8_encode( trim( $iptc['2#005'][0] ) );
if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption
@ -317,13 +319,13 @@ function wp_read_image_metadata( $file ) {
if ( ! empty($exif['FNumber'] ) )
$meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );
if ( ! empty($exif['Model'] ) )
$meta['camera'] = trim( $exif['Model'] );
$meta['camera'] = utf8_encode( trim( $exif['Model'] ) );
if ( ! empty($exif['DateTimeDigitized'] ) )
$meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized'] );
if ( ! empty($exif['FocalLength'] ) )
$meta['focal_length'] = wp_exif_frac2dec( $exif['FocalLength'] );
if ( ! empty($exif['ISOSpeedRatings'] ) )
$meta['iso'] = $exif['ISOSpeedRatings'];
$meta['iso'] = utf8_encode( trim( $exif['ISOSpeedRatings'] ) );
if ( ! empty($exif['ExposureTime'] ) )
$meta['shutter_speed'] = wp_exif_frac2dec( $exif['ExposureTime'] );
}