Changeset 35481
- Timestamp:
- 10/31/2015 10:48:08 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r35479 r35481 823 823 // Generate 'srcset' and 'sizes' if not already present. 824 824 if ( empty( $attr['srcset'] ) ) { 825 $image_meta = wp_get_attachment_metadata( $attachment_id);825 $image_meta = get_post_meta( $attachment_id, '_wp_attachment_metadata', true ); 826 826 827 827 if ( is_array( $image_meta ) ) { 828 828 $size_array = array( absint( $width ), absint( $height ) ); 829 829 $srcset = wp_calculate_image_srcset( $src, $size_array, $image_meta, $attachment_id ); 830 $sizes = wp_get_attachment_image_sizes( $size_array, $image_meta, $attachment_id );830 $sizes = wp_get_attachment_image_sizes( $size_array, $image_meta, $attachment_id, $src ); 831 831 832 832 if ( $srcset && ( $sizes || ! empty( $attr['sizes'] ) ) ) { … … 1092 1092 * @param int $attachment_id Optional. Image attachment ID. Either `$image_meta` or `$attachment_id` is needed 1093 1093 * when using the image size name as argument for `$size`. 1094 * @param string $image_url Optional. The URL to the image file. 1094 1095 * 1095 1096 * @return string|bool A valid source size value for use in a 'sizes' attribute or false. 1096 1097 */ 1097 function wp_get_attachment_image_sizes( $size, $image_meta = null, $attachment_id = 0 ) {1098 function wp_get_attachment_image_sizes( $size, $image_meta = null, $attachment_id = 0, $image_url = null ) { 1098 1099 $width = 0; 1099 1100 … … 1132 1133 * @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'. 1133 1134 * @param int $attachment_id Image attachment ID of the original image. 1134 */ 1135 return apply_filters( 'wp_get_attachment_image_sizes', $sizes, $size, $image_meta, $attachment_id ); 1135 * @param string $image_url Optional. The URL to the image file. 1136 */ 1137 return apply_filters( 'wp_get_attachment_image_sizes', $sizes, $size, $image_meta, $attachment_id, $image_url ); 1136 1138 } 1137 1139 … … 1249 1251 1250 1252 if ( $srcset ) { 1251 $sizes = wp_get_attachment_image_sizes( $size_array, $image_meta, $attachment_id );1253 $sizes = wp_get_attachment_image_sizes( $size_array, $image_meta, $attachment_id, $src ); 1252 1254 } 1253 1255
Note: See TracChangeset
for help on using the changeset viewer.