W3cubDocs

/WordPress

WP_Image_Editor::get_extension( string $mime_type = null )

Returns first matched extension from Mime-type, as mapped from wp_get_mime_types()

Description

Parameters

$mime_type

(string) (Optional)

Default value: null

Return

(string|false)

Source

File: wp-includes/class-wp-image-editor.php

protected static function get_extension( $mime_type = null ) {
		$extensions = explode( '|', array_search( $mime_type, wp_get_mime_types() ) );

		if ( empty( $extensions[0] ) ) {
			return false;
		}

		return $extensions[0];
	}

Changelog

Version Description
3.5.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_image_editor/get_extension