WP_Image_Editor::make_image( string|stream $filename, callable $function, array $arguments )
Either calls editor’s save function or handles file as a stream.
Parameters
- $filename
-
(Required)
- $function
-
(Required)
- $arguments
-
(Required)
Return
(bool)
Source
File: wp-includes/class-wp-image-editor.php
protected function make_image( $filename, $function, $arguments ) {
if ( $stream = wp_is_stream( $filename ) ) {
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( $function, $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;
}
Changelog
Version | Description |
---|---|
WP-3.5.0 | Introduced. |