Changeset 10744 for trunk/wp-includes/media.php
- Timestamp:
- 03/08/2009 05:42:17 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/media.php
r10682 r10744 515 515 516 516 /** 517 * Retrieve img HTML content for an image to represent an attachment. 518 * 519 * @see wp_get_attachment_image_src() Returns img HTML element based on array. 517 * Get an HTML img element representing an image attachment 518 * 519 * @uses apply_filters() Calls 'wp_get_attachment_image_attributes' hook on attributes array 520 * @uses wp_get_attachment_image_src() Gets attachment file URL and dimensions 520 521 * @since 2.5.0 521 522 * … … 534 535 if ( is_array($size) ) 535 536 $size = join('x', $size); 536 $html = '<img src="'.attribute_escape($src).'" '.$hwstring.'class="attachment-'.attribute_escape($size).'" alt="" />'; 537 $attachment =& get_post($attachment_id); 538 $attr = array( 539 'src' => $src, 540 'class' => "attachment-$size", 541 'alt' => trim(strip_tags( $attachment->post_excerpt )), 542 'title' => trim(strip_tags( $attachment->post_title )), 543 ); 544 $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment ); 545 $attr = array_map( 'attribute_escape', $attr ); 546 $html = rtrim("<img $hwstring"); 547 foreach ( $attr as $name => $value ) { 548 $html .= " $name=" . '"' . $value . '"'; 549 } 550 $html .= ' />'; 537 551 } 538 552
Note: See TracChangeset
for help on using the changeset viewer.