mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Media: add a new image size, medium_large
. Bumps db version to add new options.
Adds unit tests. Props DH-Shredder, joemcgill, azaozz. Fixes #34196. Built from https://develop.svn.wordpress.org/trunk@35479 git-svn-id: http://core.svn.wordpress.org/trunk@35443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
382d455235
commit
d8eacd51d8
@ -506,6 +506,10 @@ function populate_options() {
|
||||
// 4.3.0
|
||||
'finished_splitting_shared_terms' => 1,
|
||||
'site_icon' => 0,
|
||||
|
||||
// 4.4.0
|
||||
'medium_large_size_w' => 768,
|
||||
'medium_large_size_h' => 0,
|
||||
);
|
||||
|
||||
// 3.3
|
||||
|
@ -84,7 +84,7 @@ if ( is_multisite() && ! is_super_admin() && 'update' != $action ) {
|
||||
$whitelist_options = array(
|
||||
'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'timezone_string', 'WPLANG' ),
|
||||
'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ),
|
||||
'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),
|
||||
'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'medium_large_size_w', 'medium_large_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),
|
||||
'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ),
|
||||
'writing' => array( 'default_category', 'default_email_category', 'default_link_category', 'default_post_format' )
|
||||
);
|
||||
|
@ -212,7 +212,7 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
|
||||
* @access public
|
||||
*
|
||||
* @param array $sizes {
|
||||
* An array of image size arrays. Default sizes are 'small', 'medium', 'large'.
|
||||
* An array of image size arrays. Default sizes are 'small', 'medium', 'medium_large', 'large'.
|
||||
*
|
||||
* Either a height or width must be provided.
|
||||
* If one of the two is set to null, the resize will
|
||||
|
@ -270,7 +270,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
|
||||
* @access public
|
||||
*
|
||||
* @param array $sizes {
|
||||
* An array of image size arrays. Default sizes are 'small', 'medium', 'large'.
|
||||
* An array of image size arrays. Default sizes are 'small', 'medium', 'medium_large', 'large'.
|
||||
*
|
||||
* Either a height or width must be provided.
|
||||
* If one of the two is set to null, the resize will
|
||||
|
@ -513,6 +513,16 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
'readonly' => false,
|
||||
'option' => 'medium_size_h'
|
||||
),
|
||||
'medium_large_size_w' => array(
|
||||
'desc' => __( 'Medium-Large size image width' ),
|
||||
'readonly' => false,
|
||||
'option' => 'medium_large_size_w'
|
||||
),
|
||||
'medium_large_size_h' => array(
|
||||
'desc' => __( 'Medium-Large size image height' ),
|
||||
'readonly' => false,
|
||||
'option' => 'medium_large_size_h'
|
||||
),
|
||||
'large_size_w' => array(
|
||||
'desc' => __( 'Large size image width' ),
|
||||
'readonly' => false,
|
||||
|
@ -3662,6 +3662,8 @@ function sanitize_option( $option, $value ) {
|
||||
case 'thumbnail_size_h':
|
||||
case 'medium_size_w':
|
||||
case 'medium_size_h':
|
||||
case 'medium_large_size_w':
|
||||
case 'medium_large_size_h':
|
||||
case 'large_size_w':
|
||||
case 'large_size_h':
|
||||
case 'mailserver_port':
|
||||
|
@ -14,7 +14,7 @@
|
||||
* The `$size` parameter accepts either an array or a string. The supported string
|
||||
* values are 'thumb' or 'thumbnail' for the given thumbnail size or defaults at
|
||||
* 128 width and 96 height in pixels. Also supported for the string value is
|
||||
* 'medium' and 'full'. The 'full' isn't actually supported, but any value other
|
||||
* 'medium', 'medium_large' and 'full'. The 'full' isn't actually supported, but any value other
|
||||
* than the supported will result in the content_width size or 500 if that is
|
||||
* not set.
|
||||
*
|
||||
@ -60,7 +60,15 @@ function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co
|
||||
elseif ( $size == 'medium' ) {
|
||||
$max_width = intval(get_option('medium_size_w'));
|
||||
$max_height = intval(get_option('medium_size_h'));
|
||||
// if no width is set, default to the theme content width if available
|
||||
|
||||
}
|
||||
elseif ( $size == 'medium_large' ) {
|
||||
$max_width = intval( get_option( 'medium_large_size_w' ) );
|
||||
$max_height = intval( get_option( 'medium_large_size_h' ) );
|
||||
|
||||
if ( intval( $content_width ) > 0 ) {
|
||||
$max_width = min( intval( $content_width ), $max_width );
|
||||
}
|
||||
}
|
||||
elseif ( $size == 'large' ) {
|
||||
/*
|
||||
@ -71,8 +79,9 @@ function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co
|
||||
*/
|
||||
$max_width = intval(get_option('large_size_w'));
|
||||
$max_height = intval(get_option('large_size_h'));
|
||||
if ( intval($content_width) > 0 )
|
||||
if ( intval($content_width) > 0 ) {
|
||||
$max_width = min( intval($content_width), $max_width );
|
||||
}
|
||||
} elseif ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ) ) ) {
|
||||
$max_width = intval( $_wp_additional_image_sizes[$size]['width'] );
|
||||
$max_height = intval( $_wp_additional_image_sizes[$size]['height'] );
|
||||
@ -706,7 +715,7 @@ function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) {
|
||||
*/
|
||||
function get_intermediate_image_sizes() {
|
||||
global $_wp_additional_image_sizes;
|
||||
$image_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes
|
||||
$image_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); // Standard sizes
|
||||
if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
|
||||
$image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
|
||||
|
||||
@ -716,7 +725,7 @@ function get_intermediate_image_sizes() {
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @param array $image_sizes An array of intermediate image sizes. Defaults
|
||||
* are 'thumbnail', 'medium', 'large'.
|
||||
* are 'thumbnail', 'medium', 'medium_large', 'large'.
|
||||
*/
|
||||
return apply_filters( 'intermediate_image_sizes', $image_sizes );
|
||||
}
|
||||
|
@ -4,14 +4,14 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.4-beta2-35478';
|
||||
$wp_version = '4.4-beta2-35479';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
*
|
||||
* @global int $wp_db_version
|
||||
*/
|
||||
$wp_db_version = 35329;
|
||||
$wp_db_version = 35465;
|
||||
|
||||
/**
|
||||
* Holds the TinyMCE version
|
||||
|
Loading…
Reference in New Issue
Block a user