Make WordPress Core

Ticket #34430: 34430.8.diff

File 34430.8.diff, 2.8 KB (added by jaspermdegroot, 8 years ago)
  • src/wp-includes/media.php

    diff --git src/wp-includes/media.php src/wp-includes/media.php
    index 17af247..972fa96 100644
    function _wp_upload_dir_baseurl() { 
    895895 * @since 4.4.0
    896896 * @access private
    897897 *
    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.).
    899899 * @param array  $image_meta The image meta data.
    900900 * @return array|bool Array of width and height values in pixels (in that order)
    901901 *                    or false if the size doesn't exist.
    function _wp_get_image_size_from_meta( $size_name, $image_meta ) { 
    921921 *
    922922 * @since 4.4.0
    923923 *
    924 
    925924 * @param int          $attachment_id Optional. Image attachment ID.
    926925 * @param array|string $size          Image size. Accepts any valid image size, or an array of width and height
    927926 *                                    values in pixels (in that order). Default 'medium'.
    function wp_get_attachment_image_srcset( $attachment_id, $size = 'medium', $imag 
    954953        return wp_image_srcset_attr( $sources, $size_array, $image_meta, $attachment_id );
    955954}
    956955
    957 
    958956/**
    959957 * A helper function to concatenate and filter the 'srcset' attribute value.
    960958 *
    function wp_calculate_image_srcset( $image_name, $size_array, $image_meta, $atta 
    10241022                return false;
    10251023        }
    10261024
    1027         // Add full size to the '$img_sizes' array.
     1025        // Add full size to the '$image_sizes' array.
    10281026        $image_sizes['full'] = array(
    10291027                'width'  => $image_meta['width'],
    10301028                'height' => $image_meta['height'],
    function wp_calculate_image_srcset( $image_name, $size_array, $image_meta, $atta 
    11021100         *
    11031101         * @since 4.4.0
    11041102         *
    1105          * @param array        $sources       An array of image URLs and widths.
     1103         * @param array        $sources       An array of image URLs, descriptors, and values.
    11061104         * @param int          $attachment_id Image attachment ID.
    11071105         * @param array|string $size          Image size. Image size name, or an array of width and height
    11081106         *                                    values in pixels (in that order).
    11091107         * @param array        $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
    1110 
    11111108         */
    11121109        return apply_filters( 'wp_calculate_image_srcset', array_values( $sources ), $attachment_id, $size_array, $image_meta );
    11131110}
    function wp_get_attachment_image_sizes( $size, $image_meta = null, $attachment_i 
    11381135                }
    11391136
    11401137                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] );
    11441141                        }
    11451142                }
    11461143        }