Media: Add two new intermediate image sizes, 1536px and 2048px. They are meant to enhance the way WordPress displays images on the front-end on larger, high-density devices. They make it possible to generate more suitable `srcset` and `sizes` attributes, and not use the original, often non-optimized image.
Also change the default `max_srcset_image_width` value to match the new max size. Props pierlo, azaozz. See #43524. Built from https://develop.svn.wordpress.org/trunk@46066 git-svn-id: http://core.svn.wordpress.org/trunk@45878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8fe3c3fa23
commit
3b976836a8
|
@ -519,6 +519,7 @@ add_filter( 'the_content', 'do_shortcode', 11 ); // AFTER wpautop()
|
||||||
// Media
|
// Media
|
||||||
add_action( 'wp_playlist_scripts', 'wp_playlist_scripts' );
|
add_action( 'wp_playlist_scripts', 'wp_playlist_scripts' );
|
||||||
add_action( 'customize_controls_enqueue_scripts', 'wp_plupload_default_settings' );
|
add_action( 'customize_controls_enqueue_scripts', 'wp_plupload_default_settings' );
|
||||||
|
add_action( 'plugins_loaded', '_wp_add_additional_image_sizes', 0 );
|
||||||
|
|
||||||
// Nav menu
|
// Nav menu
|
||||||
add_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2 );
|
add_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2 );
|
||||||
|
|
|
@ -1200,10 +1200,10 @@ function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac
|
||||||
*
|
*
|
||||||
* @since 4.4.0
|
* @since 4.4.0
|
||||||
*
|
*
|
||||||
* @param int $max_width The maximum image width to be included in the 'srcset'. Default '1600'.
|
* @param int $max_width The maximum image width to be included in the 'srcset'. Default '2048'.
|
||||||
* @param array $size_array Array of width and height values in pixels (in that order).
|
* @param array $size_array Array of width and height values in pixels (in that order).
|
||||||
*/
|
*/
|
||||||
$max_srcset_image_width = apply_filters( 'max_srcset_image_width', 1600, $size_array );
|
$max_srcset_image_width = apply_filters( 'max_srcset_image_width', 2048, $size_array );
|
||||||
|
|
||||||
// Array to hold URL candidates.
|
// Array to hold URL candidates.
|
||||||
$sources = array();
|
$sources = array();
|
||||||
|
@ -4329,3 +4329,23 @@ function wp_media_personal_data_exporter( $email_address, $page = 1 ) {
|
||||||
'done' => $done,
|
'done' => $done,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add additional default image sub-sizes.
|
||||||
|
*
|
||||||
|
* These sizes are meant to enhance the way WordPress displays images on the front-end on larger,
|
||||||
|
* high-density devices. They make it possible to generate more suitable `srcset` and `sizes` attributes
|
||||||
|
* when the users upload large images.
|
||||||
|
*
|
||||||
|
* The sizes can be changed or removed by themes and plugins but that is not recommended.
|
||||||
|
* The size "names" reflect the image dimensions, so changing the sizes would be quite misleading.
|
||||||
|
*
|
||||||
|
* @since 5.3.0
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
function _wp_add_additional_image_sizes() {
|
||||||
|
// 2x medium_large size
|
||||||
|
add_image_size( '1536x1536', 1536, 1536 );
|
||||||
|
// 2x large size
|
||||||
|
add_image_size( '2048x2048', 2048, 2048 );
|
||||||
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.3-alpha-46028';
|
$wp_version = '5.3-alpha-46066';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue