diff --git src/wp-includes/media.php src/wp-includes/media.php
index 17af247..972fa96 100644
|
|
|
function _wp_upload_dir_baseurl() { |
| 895 | 895 | * @since 4.4.0 |
| 896 | 896 | * @access private |
| 897 | 897 | * |
| 898 | | * @param string $size_name Image size. Accepts any valid image size name (thumbnail, medium, etc.). |
| | 898 | * @param string $size_name Image size. Accepts any valid image size name ('thumbnail', 'medium', etc.). |
| 899 | 899 | * @param array $image_meta The image meta data. |
| 900 | 900 | * @return array|bool Array of width and height values in pixels (in that order) |
| 901 | 901 | * or false if the size doesn't exist. |
| … |
… |
function _wp_get_image_size_from_meta( $size_name, $image_meta ) { |
| 921 | 921 | * |
| 922 | 922 | * @since 4.4.0 |
| 923 | 923 | * |
| 924 | | |
| 925 | 924 | * @param int $attachment_id Optional. Image attachment ID. |
| 926 | 925 | * @param array|string $size Image size. Accepts any valid image size, or an array of width and height |
| 927 | 926 | * values in pixels (in that order). Default 'medium'. |
| … |
… |
function wp_get_attachment_image_srcset( $attachment_id, $size = 'medium', $imag |
| 954 | 953 | return wp_image_srcset_attr( $sources, $size_array, $image_meta, $attachment_id ); |
| 955 | 954 | } |
| 956 | 955 | |
| 957 | | |
| 958 | 956 | /** |
| 959 | 957 | * A helper function to concatenate and filter the 'srcset' attribute value. |
| 960 | 958 | * |
| … |
… |
function wp_calculate_image_srcset( $image_name, $size_array, $image_meta, $atta |
| 1024 | 1022 | return false; |
| 1025 | 1023 | } |
| 1026 | 1024 | |
| 1027 | | // Add full size to the '$img_sizes' array. |
| | 1025 | // Add full size to the '$image_sizes' array. |
| 1028 | 1026 | $image_sizes['full'] = array( |
| 1029 | 1027 | 'width' => $image_meta['width'], |
| 1030 | 1028 | 'height' => $image_meta['height'], |
| … |
… |
function wp_calculate_image_srcset( $image_name, $size_array, $image_meta, $atta |
| 1102 | 1100 | * |
| 1103 | 1101 | * @since 4.4.0 |
| 1104 | 1102 | * |
| 1105 | | * @param array $sources An array of image URLs and widths. |
| | 1103 | * @param array $sources An array of image URLs, descriptors, and values. |
| 1106 | 1104 | * @param int $attachment_id Image attachment ID. |
| 1107 | 1105 | * @param array|string $size Image size. Image size name, or an array of width and height |
| 1108 | 1106 | * values in pixels (in that order). |
| 1109 | 1107 | * @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'. |
| 1110 | | |
| 1111 | 1108 | */ |
| 1112 | 1109 | return apply_filters( 'wp_calculate_image_srcset', array_values( $sources ), $attachment_id, $size_array, $image_meta ); |
| 1113 | 1110 | } |
| … |
… |
function wp_get_attachment_image_sizes( $size, $image_meta = null, $attachment_i |
| 1138 | 1135 | } |
| 1139 | 1136 | |
| 1140 | 1137 | if ( is_array( $image_meta ) ) { |
| 1141 | | $width = _wp_get_image_size_from_meta( $size, $image_meta ); |
| 1142 | | if ( $width ) { |
| 1143 | | $width = absint( $width[0] ); |
| | 1138 | $size_array = _wp_get_image_size_from_meta( $size, $image_meta ); |
| | 1139 | if ( $size_array ) { |
| | 1140 | $width = absint( $size_array[0] ); |
| 1144 | 1141 | } |
| 1145 | 1142 | } |
| 1146 | 1143 | } |