diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
index c93c3dbabf..71bc4e4ff6 100644
a
|
b
|
function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon |
946 | 946 | return isset( $image['0'] ) ? $image['0'] : false; |
947 | 947 | } |
948 | 948 | |
| 949 | /** |
| 950 | * Get the path of an image attachment. |
| 951 | * |
| 952 | * @since X.X.X |
| 953 | * |
| 954 | * @param int $attachment_id Image attachment ID. |
| 955 | * @param string|array $size Optional. Image size to retrieve. Accepts any valid image size, or an array |
| 956 | * of width and height values in pixels (in that order). Default 'thumbnail'. |
| 957 | * @return string|false Attachment path or false if no image is available. |
| 958 | */ |
| 959 | function wp_get_attachment_image_file( $attachment_id, $size = 'thumbnail' ) { |
| 960 | |
| 961 | // get the file array |
| 962 | $file = wp_get_attachment_metadata( attachment_id ); |
| 963 | |
| 964 | if ( $file ) { |
| 965 | |
| 966 | // get file name |
| 967 | $file_name = isset ( $file[ 'sizes' ][ $size ][ 'file' ] ) ? $file[ 'sizes' ][ $size ][ 'file' ] : false; |
| 968 | |
| 969 | // get file path |
| 970 | $file_path = _wp_get_attachment_relative_path( $file_name ); |
| 971 | |
| 972 | // return path |
| 973 | if ( ! empty( $file_path) ) { |
| 974 | |
| 975 | $path = ABSPATH . '/wp-content/uploads/' . trailingslashit( $file_path ) . $file_name; |
| 976 | return $path; |
| 977 | } |
| 978 | } |
| 979 | |
| 980 | return false; |
| 981 | } |
| 982 | |
949 | 983 | /** |
950 | 984 | * Get the attachment path relative to the upload directory. |
951 | 985 | * |