Changeset 29206 for trunk/src/wp-admin/includes/image.php
- Timestamp:
- 07/17/2014 09:13:53 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/image.php
r28808 r29206 48 48 $dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file ); 49 49 50 // The directory containing the original file may no longer exist when 51 // using a replication plugin. 50 /* 51 * The directory containing the original file may no longer exist when 52 * using a replication plugin. 53 */ 52 54 wp_mkdir_p( dirname( $dst_file ) ); 53 55 … … 80 82 $metadata['height'] = $imagesize[1]; 81 83 82 // Make the file path relative to the upload dir 84 // Make the file path relative to the upload dir. 83 85 $metadata['file'] = _wp_relative_upload_path($file); 84 86 85 // make thumbnails and other intermediate sizes87 // Make thumbnails and other intermediate sizes. 86 88 global $_wp_additional_image_sizes; 87 89 … … 121 123 } 122 124 123 // fetch additional metadata from exif/iptc125 // Fetch additional metadata from EXIF/IPTC. 124 126 $image_meta = wp_read_image_metadata( $file ); 125 127 if ( $image_meta ) … … 135 137 136 138 if ( $support && ! empty( $metadata['image']['data'] ) ) { 137 // check for existing cover139 // Check for existing cover. 138 140 $hash = md5( $metadata['image']['data'] ); 139 141 $posts = get_posts( array( … … 188 190 } 189 191 190 // remove the blob of binary data from the array192 // Remove the blob of binary data from the array. 191 193 if ( isset( $metadata['image']['data'] ) ) 192 194 unset( $metadata['image']['data'] ); … … 255 257 list( , , $sourceImageType ) = getimagesize( $file ); 256 258 257 // exif contains a bunch of data we'll probably never need formatted in ways 258 // that are difficult to use. We'll normalize it and just extract the fields 259 // that are likely to be useful. Fractions and numbers are converted to 260 // floats, dates to unix timestamps, and everything else to strings. 259 /* 260 * EXIF contains a bunch of data we'll probably never need formatted in ways 261 * that are difficult to use. We'll normalize it and just extract the fields 262 * that are likely to be useful. Fractions and numbers are converted to 263 * floats, dates to unix timestamps, and everything else to strings. 264 */ 261 265 $meta = array( 262 266 'aperture' => 0, … … 272 276 ); 273 277 274 // read iptc first, since it might contain data not available in exif such 275 // as caption, description etc 278 /* 279 * Read IPTC first, since it might contain data not available in exif such 280 * as caption, description etc. 281 */ 276 282 if ( is_callable( 'iptcparse' ) ) { 277 283 getimagesize( $file, $info ); … … 280 286 $iptc = iptcparse( $info['APP13'] ); 281 287 282 // headline, "A brief synopsis of the caption."283 if ( ! empty( $iptc['2#105'][0] ) ) 288 // Headline, "A brief synopsis of the caption." 289 if ( ! empty( $iptc['2#105'][0] ) ) { 284 290 $meta['title'] = trim( $iptc['2#105'][0] ); 285 // title, "Many use the Title field to store the filename of the image, though the field may be used in many ways." 286 elseif ( ! empty( $iptc['2#005'][0] ) ) 291 /* 292 * Title, "Many use the Title field to store the filename of the image, 293 * though the field may be used in many ways." 294 */ 295 } elseif ( ! empty( $iptc['2#005'][0] ) ) { 287 296 $meta['title'] = trim( $iptc['2#005'][0] ); 297 } 288 298 289 299 if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption … … 569 579 $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) ); 570 580 571 // The directory containing the original file may no longer exist when 572 // using a replication plugin. 581 /* 582 * The directory containing the original file may no longer 583 * exist when using a replication plugin. 584 */ 573 585 wp_mkdir_p( dirname( $dst_file ) ); 574 586
Note: See TracChangeset
for help on using the changeset viewer.