Title: image_make_intermediate_size
Published: April 25, 2014
Last modified: August 20, 2026

---

# image_make_intermediate_size( string $file, int $width, int $height, bool|array $crop = false ): array|false

## In this article

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

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

Resizes an image to make a thumbnail or intermediate size.

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

The returned array has the file size, the image width, and image height. The [‘image_make_intermediate_size’](https://developer.wordpress.org/reference/hooks/image_make_intermediate_size/)
filter can be used to hook in and change the values of the returned array. The only
parameter is the resized file path.

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

 `$file`stringrequired

File path.

`$width`intrequired

Image width.

`$height`intrequired

Image height.

`$crop`bool|arrayoptional

Image cropping behavior. If false, the image will be scaled (default).
 If true,
image will be cropped to the specified dimensions using center positions. If an 
array, the image will be cropped using the array to specify the crop location:

 * `0` string
 * The x crop position. Accepts `'left'`, `'center'`, or `'right'`.
 * `1` string
 * The y crop position. Accepts `'top'`, `'center'`, or `'bottom'`.

Default:`false`

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

 array|false Metadata array on success. False if no image was created.

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

    ```php
    function image_make_intermediate_size( $file, $width, $height, $crop = false ) {
    	if ( $width || $height ) {
    		$editor = wp_get_image_editor( $file );

    		if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) ) {
    			return false;
    		}

    		$resized_file = $editor->save();

    		if ( ! is_wp_error( $resized_file ) && $resized_file ) {
    			unset( $resized_file['path'] );
    			return $resized_file;
    		}
    	}
    	return false;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/media.php#L709)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/media.php#L709-L725)

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

| Uses | Description | 
| [wp_get_image_editor()](https://developer.wordpress.org/reference/functions/wp_get_image_editor/)`wp-includes/media.php` |

Returns a [WP_Image_Editor](https://developer.wordpress.org/reference/classes/wp_image_editor/) instance and loads file into 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/functions/image_make_intermediate_size/?output_format=md#changelog)󠁿

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

## User Contributed Notes

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