| 703 | | if ( $icon && $src = wp_mime_type_icon($attachment_id) ) { |
| 704 | | /** This filter is documented in wp-includes/post.php */ |
| 705 | | $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' ); |
| 706 | | |
| 707 | | $src_file = $icon_dir . '/' . wp_basename($src); |
| 708 | | @list($width, $height) = getimagesize($src_file); |
| | 706 | $src_file = $icon_dir . '/' . wp_basename( $src ); |
| | 707 | @list( $width, $height ) = getimagesize( $src_file ); |
| | 708 | } |
| | 709 | if ( $src && $width && $height ) { |
| | 710 | $image = array( $src, $width, $height ); |
| | 711 | } |
| 710 | | if ( $src && $width && $height ) |
| 711 | | return array( $src, $width, $height ); |
| 712 | | return false; |
| | 713 | /** |
| | 714 | * Filter the image src result |
| | 715 | * |
| | 716 | * @since 4.3.0 |
| | 717 | * |
| | 718 | * @param mixed $image either array with src, width & height, icon src, or false. |
| | 719 | * @param int $attachment_id Image attachment ID. |
| | 720 | * @param string|array $size Optional. Registered image size to retrieve the source for or a flat |
| | 721 | * array of height and width dimensions. Default 'thumbnail'. |
| | 722 | * @param bool $icon Optional. Whether the image should be treated as an icon. Default false. |
| | 723 | */ |
| | 724 | return apply_filters( 'attachment_image_src', $image, $attachment_id, $size, $icon ); |