WordPress.org

Make WordPress Core

Ticket #18947: 18947_6_2.patch

File 18947_6_2.patch, 1.4 KB (added by johnnyb, 4 years ago)

Messed up 18947_6.patch, (didn't allow for crop to be an array). This fixes it.

  • wp-includes/media.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    277277        return false;
    278278}
    279279
     280
     281/**
     282 * Gets the width, height, and cropping behaviour of the named image size specified by $size.
     283 *
     284 * @see add_image_size() for details on cropping behaviour.
     285 *
     286 * @global array $_wp_additional_image_sizes Associative array of additional image sizes.
     287 *
     288 * @param string $size_name  A named image size, either built-in or added to WordPress using add_image_size()
     289 *
     290 * @return array|bool   Associative array with 'width', 'height', and (boolean) crop. These correspond to arguments
     291 *                      for add_image_size();
     292 */
     293function get_image_size( $size_name = '' ) {
     294
     295        $size = false;
     296
     297        if ( in_array( $size_name, array( 'thumbnail', 'medium', 'large' ) ) ) {
     298
     299                $size = array(
     300                        'width'  => get_option( $size_name . '_size_w' ),
     301                        'height' => get_option( $size_name . '_size_h' ),
     302                        'crop'   => get_option( $size_name . '_crop' )
     303                );
     304
     305        } elseif ( has_image_size( $size_name ) ) {
     306
     307                global $_wp_additional_image_sizes;
     308                $size = $_wp_additional_image_sizes[ $size_name ];
     309
     310        }
     311
     312        return $size;
     313}
     314
     315
    280316/**
    281317 * Registers an image size for the post thumbnail.
    282318 *