Responsive images:

- More fixes to inline docs.
- Replace the last `wp_get_attachment_metadata()` with `get_post_meta()`.
- For consistency only accept array or named size in `wp_get_attachment_image_sizes()`.

Props jaspermdegroot.
See #34430.
Built from https://develop.svn.wordpress.org/trunk@35491


git-svn-id: http://core.svn.wordpress.org/trunk@35455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2015-11-03 00:19:28 +00:00
parent 64f5e0683a
commit ea3d7c7962
2 changed files with 14 additions and 7 deletions

View File

@ -930,7 +930,7 @@ function _wp_get_image_size_from_meta( $size_name, $image_meta ) {
*
* @since 4.4.0
*
* @param int $attachment_id Optional. Image attachment ID.
* @param int $attachment_id Image attachment ID.
* @param array|string $size Image size. Accepts any valid image size, or an array of width and height
* values in pixels (in that order). Default 'medium'.
* @param array $image_meta Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.
@ -1059,7 +1059,16 @@ function wp_calculate_image_srcset( $image_name, $size_array, $image_meta, $atta
*
* @since 4.4.0
*
* @param array $sources An array of image URLs and widths.
* @param array $sources An array of sources to include in the 'srcset'. Each source
* consists of an array containing the URL and the descriptor
* type and value (default: the image width):
*
* image width => array(
* 'url' => string,
* 'descriptor' => string ('w' or 'x'),
* 'value' => integer (width or pixel density)
* },
*
* @param int $attachment_id Image attachment ID.
* @param array $size_array Array of width and height values in pixels (in that order).
* @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
@ -1098,13 +1107,11 @@ function wp_calculate_image_srcset( $image_name, $size_array, $image_meta, $atta
function wp_get_attachment_image_sizes( $size, $image_meta = null, $attachment_id = 0, $image_url = null ) {
$width = 0;
if ( is_numeric( $size ) ) {
$width = absint( $size );
} elseif ( is_array( $size ) ) {
if ( is_array( $size ) ) {
$width = absint( $size[0] );
} elseif ( is_string( $size ) ) {
if ( ! $image_meta && $attachment_id ) {
$image_meta = wp_get_attachment_metadata( $attachment_id );
$image_meta = get_post_meta( $attachment_id, '_wp_attachment_metadata', true );
}
if ( is_array( $image_meta ) ) {

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-beta2-35490';
$wp_version = '4.4-beta2-35491';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.