WordPress at a glance
function is not described

WP_Image_Editor::resize() public WP 3.5.0

Resizes current image.

At minimum, either a height or width must be provided. If one of the two is set to null, the resize will maintain aspect ratio according to the provided dimension.

{} It's a method of the class: WP_Image_Editor{}

No Hooks.


true|WP_Error. Nothing.


$WP_Image_Editor = new WP_Image_Editor();
$WP_Image_Editor->resize( $max_w, $max_h, $crop );
$max_w(int|null) (required)
Image width.
$max_h(int|null) (required)
Image height.
$crop *(true false)*


Since 3.5.0 Introduced.

Code of WP_Image_Editor::resize() WP 5.7.2

abstract public function resize( $max_w, $max_h, $crop = false );