Make WordPress Core

Ticket #34612: 34612.filter.2.diff

File 34612.filter.2.diff, 2.3 KB (added by joemcgill, 10 years ago)
  • src/wp-includes/media.php

    diff --git src/wp-includes/media.php src/wp-includes/media.php
    index 043657d..7892f93 100644
    function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac 
    10741074         *
    10751075         * @since 4.4.0
    10761076         *
    1077          * @param array $sources       An array of sources to include in the 'srcset'. Each source
    1078          *                             consists of an array containing the URL and the descriptor
    1079          *                             type and value (default: the image width):
    1080          *
    1081          *                             image width => array(
    1082          *                                 'url'        => string,
    1083          *                                 'descriptor' => string ('w' or 'x'),
    1084          *                                 'value'      => integer (width or pixel density)
    1085          *                             },
    1086          *
    1087          * @param int   $attachment_id Image attachment ID.
    1088          * @param array $size_array    Array of width and height values in pixels (in that order).
    1089          * @param array $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
     1077         * @param array  $sources {
     1078         *     An array of sources to include in the 'srcset'.
     1079         *
     1080         *     @type type array $width {
     1081         *          @type type string $url        The URL of an image source in the .
     1082         *          @type type string $descriptor The descriptor type used in the image candidate string, either 'w' or 'x'.
     1083         *          @type type int    $value      The source width, if paired with a 'w' descriptor or a pixel density value
     1084         *                                        if paired with an 'x' descriptor.
     1085         *     }
     1086         * }
     1087         * @param array  $size_array    Array of width and height values in pixels (in that order).
     1088         * @param string $image_src     The 'src' of the image.
     1089         * @param array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
     1090         * @param int    $attachment_id Image attachment ID.
    10901091
    10911092         */
    1092         $sources = apply_filters( 'wp_calculate_image_srcset', $sources, $attachment_id, $size_array, $image_meta );
     1093        $sources = apply_filters( 'wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id );
    10931094
    10941095        // Only return a 'srcset' value if there is more than one source.
    10951096        if ( count( $sources ) < 2 ) {