WordPress.org

Make WordPress Core

Ticket #18947: 18947_5_1.patch

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

Complete Patch, altering the function, fixing the missing argument from 18947_5 patch.

  • wp-includes/media.php

    From 604877dc86ab0d03bcf58e64d48b098e31d86238 Mon Sep 17 00:00:00 2001
    From: Kaiser Franz Josef <wecodemore@gmail.com>
    Date: Sat, 23 Nov 2013 17:15:33 +0100
    Subject: [PATCH] Added more info for return of get_intermediate_image_sizes()
    
    ---
     wp-includes/media.php | 21 +++++++++++++++++++--
     1 file changed, 19 insertions(+), 2 deletions(-)
    
    diff --git a/wp-includes/media.php b/wp-includes/media.php
    index 1497238..4d67aae 100644
    a b function image_get_intermediate_size($post_id, $size='thumbnail') { 
    485485 * @since 3.0.0
    486486 * @return array Returns a filtered array of image size strings
    487487 */
    488 function get_intermediate_image_sizes() {
     488function get_intermediate_image_sizes( $keys_only = true ) {
    489489        global $_wp_additional_image_sizes;
    490490        $image_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes
    491         if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
     491
     492        // This part was added during DrupalCamp Vienna 2013
     493        // while sitting next to John O'Nolan from Ghost, Jürgen Dressel the last PL1 dev,
     494        // and Günther Dressel a Drupal developer.
     495        if ( ! $keys_only ) {
     496                foreach ( $image_sizes as $size ) {
     497                        $image_sizes[ $size ]['width']  = absint( get_option( "{$size}_size_w" ) );
     498                        $image_sizes[ $size ]['height'] = absint( get_option( "{$size}_size_h" ) );
     499                        // If not set: crop false per default.
     500                        $image_sizes[ $size ]['crop']   = false;
     501                        if ( get_option( "{$size}_crop" ) ) {
     502                                $image_sizes[ $size ]['crop'] = get_option( "{$size}_crop" );
     503                        }
     504                }
     505        }
     506
     507        if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) ) {
    492508                $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
     509        }
    493510
    494511        return apply_filters( 'intermediate_image_sizes', $image_sizes );
    495512}