/** * Checks if GD is enabled and verify that key methods exist, some of which require GD to * be bundled with PHP. Exceptions will be thrown from those methods when GD is not * bundled. * * @return boolean */ public static function check() { if (!function_exists('gd_info')) { die('GD is either not installed or not enabled, check your configuration'); } $functions = array(GD::IMAGEROTATE, GD::IMAGECONVOLUTION, GD::IMAGEFILTER, GD::IMAGELAYEREFFECT); foreach ($functions as $function) { GD::$_available_functions[$function] = function_exists($function); } if (defined('GD_VERSION')) { // Get the version via a constant, available in PHP 5.2.4+ $version = GD_VERSION; } else { // Get the version information $info = gd_info(); // Extract the version number preg_match('/\\d+\\.\\d+(?:\\.\\d+)?/', $info['GD Version'], $matches); // Get the major version $version = $matches[0]; } if (!version_compare($version, '2.0.1', '>=')) { die('GD requires GD version 2.0.1 or greater, you have ' . $version); } return GD::$_checked = TRUE; }