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
256                if ( ! empty( $iptc['2#055'][0] ) and ! empty( $iptc['2#060'][0] ) ) // created date and time
257                     $meta['created_timestamp'] = strtotime( $iptc['2#055'][0] . ' ' . $iptc['2#060'][0] );
258
259                if ( ! empty( $iptc['2#116'][0] ) ) // copyright
260                     $meta['copyright'] = utf8_encode( trim( $iptc['2#116'][0] ) );
261            }
262      }
263
264      // fetch additional info from exif if available
265      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 ) ) ) ) {
266           $exif = @exif_read_data( $file );
267
268           if ( !empty( $exif['Title'] ) )
269                $meta['title'] = utf8_encode( trim( $exif['Title'] ) );
270
271           if ( ! empty( $exif['ImageDescription'] ) ) {
272                if ( empty( $meta['title'] ) && strlen( $exif['ImageDescription'] ) < 80 ) {
273                     // Assume the title is stored in ImageDescription
274                     $meta['title'] = utf8_encode( trim( $exif['ImageDescription'] ) );