define("GD_VERSION",2); /** * check if GD is installed and is version 2 or higher * @license http://opensource.org/licenses/gpl-license.php GNU Public License */ if (! extension_loaded('gd')) { echo "The GD extension was not found!"; } else { if (function_exists('gd_info')) { // use gd_info if possible... $gd_ver_info = gd_info(); preg_match('/\d/', $gd_ver_info['GD Version'], $match); if ($match[0] < GD_VERSION) { echo "This program needs GD version 2 or higher to run properly."; } } else { // ...otherwise use phpinfo(). ob_start(); phpinfo(8); $info = ob_get_contents(); ob_end_clean(); $info = stristr($info, 'gd version'); preg_match('/\d/', $info, $match); if ($match[0] < GD_VERSION) { echo "This module requires the GD Library version 2 or higher."; } } }