WP_Image_Editor_GD::test() WordPress Method

The WP_Image_Editor_GD::test() method allows you to test whether the GD image library is installed and working properly. This is important because the GD image library is required for WordPress to be able to resize and edit images.

WP_Image_Editor_GD::test( array $args = array() ) #

Checks to see if current environment supports GD.


Parameters

$args

(array)(Optional)

Default value: array()


Top ↑

Return

(bool)


Top ↑

Source

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

	public static function test( $args = array() ) {
		if ( ! extension_loaded( 'gd' ) || ! function_exists( 'gd_info' ) ) {
			return false;
		}

		// On some setups GD library does not provide imagerotate() - Ticket #11536.
		if ( isset( $args['methods'] ) &&
			in_array( 'rotate', $args['methods'], true ) &&
			! function_exists( 'imagerotate' ) ) {

				return false;
		}

		return true;
	}

Top ↑

Changelog

Changelog
VersionDescription
3.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.