Make WordPress Core

Ticket #14110: wp_get_attachment_image_shortened.diff

File wp_get_attachment_image_shortened.diff, 1.1 KB (added by divinenephron, 14 years ago)

Only the changed that are essential to the enhancement.

  • /Users/nephron/Sites/wordpress/wp-includes/

    old new  
    638638        $image = wp_get_attachment_image_src($attachment_id, $size, $icon);
    639639        if ( $image ) {
    640640                list($src, $width, $height) = $image;
    641                 $hwstring = image_hwstring($width, $height);
    642641                if ( is_array($size) )
    643642                        $size = join('x', $size);
    644643                $attachment =& get_post($attachment_id);
    645644                $default_attr = array(
    646645                        'src'   => $src,
     646      'height' => intval($height),
     647      'width' => intval($width),
    647648                        'class' => "attachment-$size",
    648649                        'alt'   => trim(strip_tags( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) )), // Use Alt field first
    649650                        'title' => trim(strip_tags( $attachment->post_title )),
     
    656657                $attr = wp_parse_args($attr, $default_attr);
    657658                $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment );
    658659                $attr = array_map( 'esc_attr', $attr );
    659                 $html = rtrim("<img $hwstring");
     660                $html = "<img";
    660661                foreach ( $attr as $name => $value ) {
    661662                        $html .= " $name=" . '"' . $value . '"';
    662663                }