WordPress.org

Make WordPress Core

Ticket #18947: 18947_4.patch

File 18947_4.patch, 1.3 KB (added by F J Kaiser, 5 years ago)

Updated to current nightly build trunk

  • wp-includes/media.php

     
    482482/**
    483483 * Get the available image sizes
    484484 * @since 3.0.0
    485  * @return array Returns a filtered array of image size strings
     485 * @param bool $keys_only Whether to return only the keys or an assoc array of
     486 *                        image sizes with their associated size & crop values as sub array.
     487 * @return array $image_sizes Returns a filtered array of image size strings
    486488 */
    487 function get_intermediate_image_sizes() {
     489function get_intermediate_image_sizes( $keys_only = true ) {
    488490        global $_wp_additional_image_sizes;
    489491        $image_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes
     492        if ( ! $keys_only ) {
     493                foreach ( $image_sizes as $size ) {
     494                        $image_sizes[ $size ]['width']  = intval( get_option( "{$size}_size_w") );
     495                        $image_sizes[ $size ]['height'] = intval( get_option( "{$size}_size_h") );
     496                        // Crop false per default if not set
     497                        $image_sizes[ $size ]['crop']   = get_option( "{$size}_crop" ) ? get_option( "{$size}_crop" ) : false;
     498                }
     499        }
    490500        if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
    491501                $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
    492502