public static function isGdExtensionEnabled()
    {
        static $gd = null;
        if (is_null($gd)) {
            $gd = false;

            $extensions = @get_loaded_extensions();
            if (is_array($extensions)) {
                $gd = in_array('gd', $extensions) && function_exists('imageftbbox');
            }
        }

        return $gd;
    }