WP_Image_Editor_GD::save()publicWP 3.5.0

Saves current in-memory image to file.

Метод класса: WP_Image_Editor_GD{}

Хуков нет.

Возвращает

Массив|WP_Error. Array on success or WP_Error if the file failed to save.

Использование

$WP_Image_Editor_GD = new WP_Image_Editor_GD();
$WP_Image_Editor_GD->save( $destfilename, $mime_type );
$destfilename(строка|null)
Destination filename.
По умолчанию: null
$mime_type(строка|null)
The mime-type.
По умолчанию: null

Список изменений

С версии 3.5.0 Введена.
С версии 5.9.0 Renamed $filename to $destfilename to match parent class for PHP 8 named parameter support.
С версии 6.0.0 The $filesize value was added to the returned array.

Код WP_Image_Editor_GD::save() WP 6.5.2

public function save( $destfilename = null, $mime_type = null ) {
	$saved = $this->_save( $this->image, $destfilename, $mime_type );

	if ( ! is_wp_error( $saved ) ) {
		$this->file      = $saved['path'];
		$this->mime_type = $saved['mime-type'];
	}

	return $saved;
}