Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_read_image_metadata_types

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
228                     $meta['caption'] = trim( $iptc['2#120'][0] );
229                if ( !empty($iptc['2#116'][0]) ) // copyright
230                     $meta['copyright'] = trim( $iptc['2#116'][0] );
231                if ( !empty($iptc['2#005'][0]) ) // title
232                     $meta['title'] = trim( $iptc['2#005'][0] );
233            }
234      }
235
236      // fetch additional info from exif if available
237      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)) ) ) {
238           $exif = exif_read_data( $file );
239           if (!empty($exif['FNumber']))
240                $meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );
241           if (!empty($exif['Model']))
242                $meta['camera'] = trim( $exif['Model'] );
243           if (!empty($exif['DateTimeDigitized']))
244                $meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized']);
245           if (!empty($exif['FocalLength']))
246                $meta['focal_length'] = wp_exif_frac2dec( $exif['FocalLength'] );