Ticket #30525: mediaattributes.diff
File mediaattributes.diff, 1.2 KB (added by , 10 years ago) |
---|
-
wp-includes/media.php
696 696 $image = wp_get_attachment_image_src($attachment_id, $size, $icon); 697 697 if ( $image ) { 698 698 list($src, $width, $height) = $image; 699 $hwstring = image_hwstring($width, $height);700 699 $size_class = $size; 701 700 if ( is_array( $size_class ) ) { 702 701 $size_class = join( 'x', $size_class ); … … 706 705 'src' => $src, 707 706 'class' => "attachment-$size_class", 708 707 'alt' => trim(strip_tags( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) )), // Use Alt field first 708 'width' => $width, 709 'height' => $height, 709 710 ); 710 711 if ( empty($default_attr['alt']) ) 711 712 $default_attr['alt'] = trim(strip_tags( $attachment->post_excerpt )); // If not, Use the Caption … … 725 726 */ 726 727 $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment, $size ); 727 728 $attr = array_map( 'esc_attr', $attr ); 728 $html = rtrim("<img $hwstring");729 $html = '<img'; 729 730 foreach ( $attr as $name => $value ) { 730 731 $html .= " $name=" . '"' . $value . '"'; 731 732 }