diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
index f4492fc..a324651 100644
a
|
b
|
function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = |
694 | 694 | */ |
695 | 695 | function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false, $attr = '') { |
696 | 696 | |
697 | | $html = ''; |
| 697 | $html = ''; |
698 | 698 | $image = wp_get_attachment_image_src($attachment_id, $size, $icon); |
| 699 | |
699 | 700 | if ( $image ) { |
700 | 701 | list($src, $width, $height) = $image; |
701 | 702 | $hwstring = image_hwstring($width, $height); |
702 | | if ( is_array($size) ) |
703 | | $size = join('x', $size); |
| 703 | $size_class = $size; |
| 704 | if ( is_array( $size_class ) ) { |
| 705 | $size_class = join( 'x', $size_class ); |
| 706 | } |
704 | 707 | $attachment = get_post($attachment_id); |
705 | 708 | $default_attr = array( |
706 | 709 | 'src' => $src, |
707 | | 'class' => "attachment-$size", |
| 710 | 'class' => "attachment-$size_class", |
708 | 711 | 'alt' => trim(strip_tags( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) )), // Use Alt field first |
709 | 712 | ); |
710 | 713 | if ( empty($default_attr['alt']) ) |
… |
… |
function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = fa |
719 | 722 | * |
720 | 723 | * @since 2.8.0 |
721 | 724 | * |
722 | | * @param mixed $attr Attributes for the image markup. |
723 | | * @param int $attachment Image attachment post. |
| 725 | * @param mixed $attr Attributes for the image markup. |
| 726 | * @param int $attachment Image attachment post. |
| 727 | * @param string|array $size Requested size. |
724 | 728 | */ |
725 | | $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment ); |
| 729 | $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment, $size ); |
726 | 730 | $attr = array_map( 'esc_attr', $attr ); |
727 | 731 | $html = rtrim("<img $hwstring"); |
728 | 732 | foreach ( $attr as $name => $value ) { |