WP_Image_Editor::get_default_quality()protectedWP 5.8.1

Returns the default compression quality setting for the mime type.

Method of the class: WP_Image_Editor{}

No Hooks.

Return

Int. The default quality setting for the mime type.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_default_quality( $mime_type );
$mime_type(string) (required)
-

Changelog

Since 5.8.1 Introduced.

WP_Image_Editor::get_default_quality() code WP 6.6.2

protected function get_default_quality( $mime_type ) {
	switch ( $mime_type ) {
		case 'image/webp':
			$quality = 86;
			break;
		case 'image/jpeg':
		case 'image/avif':
		default:
			$quality = $this->default_quality;
	}

	return $quality;
}