editor_max_image_size
Filters the maximum image size dimensions for the editor.
Использование
add_filter( 'editor_max_image_size', 'wp_kama_editor_max_image_size_filter', 10, 3 ); /** * Function for `editor_max_image_size` filter-hook. * * @param int[] $max_image_size An array of width and height values. * @param string|int[] $size Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order). * @param string $context The context the image is being resized for. Possible values are 'display' (like in a theme) or 'edit' (like inserting into an editor). * * @return int[] */ function wp_kama_editor_max_image_size_filter( $max_image_size, $size, $context ){ // filter... return $max_image_size; }
- $max_image_size(int[])
An array of width and height values.
-
0(int)
The maximum width in pixels. - 1(int)
The maximum height in pixels.
-
- $size(строка|int[])
- Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
- $context(строка)
- The context the image is being resized for. Possible values are 'display' (like in a theme) or 'edit' (like inserting into an editor).
Список изменений
С версии 2.5.0 | Введена. |
Где вызывается хук
editor_max_image_size
wp-includes/media.php 138
list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size, $context );