WP_Image_Editor_GD::supports_mime_type

Advertisement

Summery Summery

Checks to see if editor supports the mime-type specified.

Syntax Syntax

WP_Image_Editor_GD::supports_mime_type( string $mime_type )

Parameters Parameters

$mime_type

(string) (Required)

Return Return

(bool)

Source Source

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

	public static function supports_mime_type( $mime_type ) {
		$image_types = imagetypes();
		switch ( $mime_type ) {
			case 'image/jpeg':
				return ( $image_types & IMG_JPG ) != 0;
			case 'image/png':
				return ( $image_types & IMG_PNG ) != 0;
			case 'image/gif':
				return ( $image_types & IMG_GIF ) != 0;
		}

		return false;
	}

Advertisement

Changelog Changelog

Changelog
Version Description
3.5.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

What are you looking for?