WordPress.org

Make WordPress Core

Ticket #18947: 18947_5.patch

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

The new 3.8 compatible patch from DrupalCamp Vienna 2013

  • wp-includes/media.php

     
    487487function get_intermediate_image_sizes() {
    488488        global $_wp_additional_image_sizes;
    489489        $image_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes
    490         if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
     490
     491        // This part was added during DrupalCamp Vienna 2013
     492        // while hanging out with John O'Nolan from Ghost, Jürgen Dressel the last PL1 dev,
     493        // and Günther Dressel a Drupal core contributor.
     494        if ( ! $keys_only ) {
     495                foreach ( $image_sizes as $size ) {
     496                        $image_sizes[ $size ]['width']  = absint( get_option( "{$size}_size_w" ) );
     497                        $image_sizes[ $size ]['height'] = absint( get_option( "{$size}_size_h" ) );
     498                        // If not set: crop false per default.
     499                        $image_sizes[ $size ]['crop']   = false;
     500                        if ( get_option( "{$size}_crop" ) ) {
     501                                $image_sizes[ $size ]['crop'] = get_option( "{$size}_crop" );
     502                        }
     503                }
     504        }
     505
     506        if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) ) {
    491507                $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
     508        }
    492509
    493510        return apply_filters( 'intermediate_image_sizes', $image_sizes );
    494511}