WordPress at a glance
function is not described

WP_Image_Editor_GD::_save() WP 1.0

This is a method of the class: WP_Image_Editor_GD

Hooks from the method
Return

Array/WP_Error.

Usage

$WP_Image_Editor_GD = new WP_Image_Editor_GD();
$var = $WP_Image_Editor_GD->_save( $image, $filename, $mime_type );
$image(resource) (required)
$filename(string/null)

Default: null
$mime_type(string/null)

Default: null

Code of WP Image Editor GD:: save: wp-includes/class-wp-image-editor-gd.php WP 5.4.1

<?php
protected function _save( $image, $filename = null, $mime_type = null ) {
	list( $filename, $extension, $mime_type ) = $this->get_output_format( $filename, $mime_type );

	if ( ! $filename ) {
		$filename = $this->generate_filename( null, null, $extension );
	}

	if ( 'image/gif' === $mime_type ) {
		if ( ! $this->make_image( $filename, 'imagegif', array( $image, $filename ) ) ) {
			return new WP_Error( 'image_save_error', __( 'Image Editor Save Failed' ) );
		}
	} elseif ( 'image/png' === $mime_type ) {
		// Convert from full colors to index colors, like original PNG.
		if ( function_exists( 'imageistruecolor' ) && ! imageistruecolor( $image ) ) {
			imagetruecolortopalette( $image, false, imagecolorstotal( $image ) );
		}

		if ( ! $this->make_image( $filename, 'imagepng', array( $image, $filename ) ) ) {
			return new WP_Error( 'image_save_error', __( 'Image Editor Save Failed' ) );
		}
	} elseif ( 'image/jpeg' === $mime_type ) {
		if ( ! $this->make_image( $filename, 'imagejpeg', array( $image, $filename, $this->get_quality() ) ) ) {
			return new WP_Error( 'image_save_error', __( 'Image Editor Save Failed' ) );
		}
	} else {
		return new WP_Error( 'image_save_error', __( 'Image Editor Save Failed' ) );
	}

	// Set correct file permissions.
	$stat  = stat( dirname( $filename ) );
	$perms = $stat['mode'] & 0000666; // Same permissions as parent folder, strip off the executable bits.
	chmod( $filename, $perms );

	/**
	 * Filters the name of the saved image file.
	 *
	 * @since 2.6.0
	 *
	 * @param string $filename Name of the file.
	 */
	return array(
		'path'      => $filename,
		'file'      => wp_basename( apply_filters( 'image_make_intermediate_size', $filename ) ),
		'width'     => $this->size['width'],
		'height'    => $this->size['height'],
		'mime-type' => $mime_type,
	);
}