Make WordPress Core


Ignore:
Timestamp:
11/03/2015 12:18:07 AM (9 years ago)
Author:
azaozz
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r35481 r35491  
    931931 * @since 4.4.0
    932932 *
    933  * @param int          $attachment_id Optional. Image attachment ID.
     933 * @param int          $attachment_id Image attachment ID.
    934934 * @param array|string $size          Image size. Accepts any valid image size, or an array of width and height
    935935 *                                    values in pixels (in that order). Default 'medium'.
     
    10601060     * @since 4.4.0
    10611061     *
    1062      * @param array $sources       An array of image URLs and widths.
     1062     * @param array $sources       An array of sources to include in the 'srcset'. Each source
     1063     *                             consists of an array containing the URL and the descriptor
     1064     *                             type and value (default: the image width):
     1065     *
     1066     *                             image width => array(
     1067     *                                 'url'        => string,
     1068     *                                 'descriptor' => string ('w' or 'x'),
     1069     *                                 'value'      => integer (width or pixel density)
     1070     *                             },
     1071     *
    10631072     * @param int   $attachment_id Image attachment ID.
    10641073     * @param array $size_array    Array of width and height values in pixels (in that order).
     
    10991108    $width = 0;
    11001109
    1101     if ( is_numeric( $size ) ) {
    1102         $width = absint( $size );
    1103     } elseif ( is_array( $size ) ) {
     1110    if ( is_array( $size ) ) {
    11041111        $width = absint( $size[0] );
    11051112    } elseif ( is_string( $size ) ) {
    11061113        if ( ! $image_meta && $attachment_id ) {
    1107             $image_meta = wp_get_attachment_metadata( $attachment_id );
     1114            $image_meta = get_post_meta( $attachment_id, '_wp_attachment_metadata', true );
    11081115        }
    11091116
Note: See TracChangeset for help on using the changeset viewer.