Title: WP_Image_Editor::make_image
Published: April 25, 2014
Last modified: February 24, 2026

---

# WP_Image_Editor::make_image( string $filename, callable $callback, array $arguments ): bool

## In this article

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

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

Either calls editor’s save function or handles file as a stream.

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

 `$filename`stringrequired

`$callback`callablerequired

`$arguments`arrayrequired

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

 bool

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

    ```php
    protected function make_image( $filename, $callback, $arguments ) {
    	$stream = wp_is_stream( $filename );
    	if ( $stream ) {
    		ob_start();
    	} else {
    		// The directory containing the original file may no longer exist when using a replication plugin.
    		wp_mkdir_p( dirname( $filename ) );
    	}

    	$result = call_user_func_array( $callback, $arguments );

    	if ( $result && $stream ) {
    		$contents = ob_get_contents();

    		$fp = fopen( $filename, 'w' );

    		if ( ! $fp ) {
    			ob_end_clean();
    			return false;
    		}

    		fwrite( $fp, $contents );
    		fclose( $fp );
    	}

    	if ( $stream ) {
    		ob_end_clean();
    	}

    	return $result;
    }
    ```

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

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

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

Tests if a given path is a stream URL

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

Recursive directory creation based on full path.

  |

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

Either calls editor’s save function or handles file as a stream.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_image_editor/make_image/?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%2Fmake_image%2F)
before being able to contribute a note or feedback.