WP_Image_Editor::make_image()
Either calls editor's save function or handles file as a stream.
Method of the class: WP_Image_Editor{}
No Hooks.
Return
true|false
.
Usage
// protected - for code of main (parent) or child class $result = $this->make_image( $filename, $callback, $arguments );
- $filename(string) (required)
- -
- $callback(callable) (required)
- -
- $arguments(array) (required)
- -
Changelog
Since 3.5.0 | Introduced. |
WP_Image_Editor::make_image() WP Image Editor::make image code WP 6.3
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; }