WP_Image_Editor::make_image() protected WP 3.5.0
Either calls editor's save function or handles file as a stream.
{} Это метод класса: WP_Image_Editor{}
Хуков нет.
Возвращает
true/false
. Null. Ничего.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->make_image( $filename, $function, $arguments );
- $filename(строка/stream) (обязательный)
- -
- $function(callable) (обязательный)
- -
- $arguments(массив) (обязательный)
- -
Список изменений
С версии 3.5.0 | Введена. |
Код WP_Image_Editor::make_image() WP Image Editor::make image WP 5.7
protected function make_image( $filename, $function, $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( $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;
}