Make WordPress Core

Ticket #21038: theme.php.patch

File theme.php.patch, 1.6 KB (added by desrosj, 13 years ago)
  • wp-includes/theme.php

     
    13551355                                define( 'BACKGROUND_IMAGE', $args[0]['default-image'] );
    13561356
    13571357                        break;
     1358
     1359                case 'high-density-screens' :
     1360                        add_action( 'after_setup_theme', 'wp_register_2x_image_sizes', 100 );
    13581361        }
    13591362
    13601363        $_wp_theme_features[ $feature ] = $args;
     
    16951698                }());
    16961699        </script>
    16971700        <?php
     1701}
     1702
     1703/**
     1704 * Adds an @2x image size for all image sizes registered through add_image_size().
     1705 *
     1706 *
     1707 */
     1708
     1709function wp_register_2x_image_sizes() {
     1710        if ( ! current_theme_supports( 'high-density-screens' ) )
     1711                return;
     1712
     1713        global $_wp_additional_image_sizes;
     1714        $image_sizes = get_intermediate_image_sizes();
     1715
     1716        foreach( $image_sizes as $image_size ) {
     1717
     1718                switch ( $image_size ) {
     1719                        case 'large' :
     1720                                add_image_size( 'large@2x', intval( get_option( 'large_size_w' ) ) * 2, intval( get_option( 'large_size_h' ) ) * 2, false );
     1721                                break;
     1722
     1723                        case 'medium' :
     1724                                add_image_size( 'medium@2x', intval( get_option( 'medium_size_w' ) ) * 2, intval( get_option( 'medium_size_h' ) ) * 2, false );
     1725                                break;
     1726
     1727                        case 'thumbnail' :
     1728                                add_image_size( 'thumbnail@2x', intval( get_option( 'thumbnail_size_w' ) ) * 2, intval( get_option( 'thumbnail_size_h' ) ) * 2, true );
     1729                                break;
     1730
     1731                        default :
     1732                                add_image_size( $image_size . '@2x', $_wp_additional_image_sizes[ $image_size ]['width'] * 2, $_wp_additional_image_sizes[ $image_size ]['height'] * 2, $_wp_additional_image_sizes[ $image_size ]['crop'] );
     1733                                break;
     1734                }
     1735
     1736        }
    16981737}
     1738 No newline at end of file