Title: WP_Image_Editor_GD::multi_resize
Published: April 25, 2014
Last modified: February 24, 2026

---

# WP_Image_Editor_GD::multi_resize( array $sizes ): array

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_image_editor_gd/multi_resize/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_image_editor_gd/multi_resize/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_image_editor_gd/multi_resize/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_image_editor_gd/multi_resize/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_image_editor_gd/multi_resize/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_image_editor_gd/multi_resize/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_image_editor_gd/multi_resize/?output_format=md#wp--skip-link--target)

Create multiple smaller images from a single source.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_image_editor_gd/multi_resize/?output_format=md#description)󠁿

Attempts to create all sub-sizes and returns the meta data at the end. This may 
result in the server running out of resources. When it fails there may be few “orphaned”
images left over as the meta data is never returned and saved.

As of 5.3.0 the preferred way to do this is with `make_subsize()`. It creates the
new images one at a time and allows for the meta data to be saved after each new
image is created.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_image_editor_gd/multi_resize/?output_format=md#parameters)󠁿

 `$sizes`arrayrequired

An array of image size data arrays.
 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 source image.

 * `...$0` array
 *  Array of height, width values, and whether to crop.
    - `width` int
    - Image width. Optional if `$height` is specified.
    - `height` int
    - Image height. Optional if `$width` is specified.
    - `crop` bool|array
    - Optional. Whether to crop the image. Default false.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_image_editor_gd/multi_resize/?output_format=md#return)󠁿

 array An array of resized images’ metadata by size.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_image_editor_gd/multi_resize/?output_format=md#source)󠁿

    ```php
    public function multi_resize( $sizes ) {
    	$metadata = array();

    	foreach ( $sizes as $size => $size_data ) {
    		$meta = $this->make_subsize( $size_data );

    		if ( ! is_wp_error( $meta ) ) {
    			$metadata[ $size ] = $meta;
    		}
    	}

    	return $metadata;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-image-editor-gd.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-image-editor-gd.php#L279)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-image-editor-gd.php#L279-L291)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_image_editor_gd/multi_resize/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Image_Editor_GD::make_subsize()](https://developer.wordpress.org/reference/classes/wp_image_editor_gd/make_subsize/)`wp-includes/class-wp-image-editor-gd.php` |

Create an image sub-size and return the image meta data value for it.

  | 
| [is_wp_error()](https://developer.wordpress.org/reference/functions/is_wp_error/)`wp-includes/load.php` |

Checks whether the given variable is a WordPress Error.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_image_editor_gd/multi_resize/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_image_editor_gd%2Fmulti_resize%2F)
before being able to contribute a note or feedback.