Gregwar / Captcha

PHP Captcha library
MIT License
1.73k stars 290 forks source link

Call to undefined function Gregwar\Captcha\imagettfbbox() #36

Open xiexiangnow opened 7 years ago

xiexiangnow commented 7 years ago

what`s question for this? thanks!

Gregwar commented 7 years ago

Do you have the GD library installed?

chippyash commented 7 years ago

I have exactly same issue: Fatal error: Uncaught Error: Call to undefined function Gregwar\Captcha\imagettfbbox() in /../vendor/gregwar/captcha/CaptchaBuilder.php on line 327 changing that line to $box = \imagettfbbox($size, 0, $font, $phrase); gives: Fatal error: Uncaught Error: Call to undefined function imagettfbbox() in /.../vendor/gregwar/captcha/CaptchaBuilder.php on line 327

php -v PHP 7.0.17 (cli) (built: Mar 21 2017 18:44:58) ( NTS )

$ php -m | grep gd gd

chucking a phpinfo(INFO_MODULES) into the code reveals:

GD Support  enabled
GD Version  bundled (2.1.0 compatible)
GIF Read Support    enabled
GIF Create Support  enabled
PNG Support enabled
libPNG Version  1.6.20
WBMP Support    enabled
XBM Support enabled

Hope that is enough to be going on. If you need anything else, please let me know. Not a GD technorati so a bit stumped. [edit] This is running PHP web internal server (php -S localhost:8000). The PHP is a Phpbrew variant.

chookg commented 7 years ago

+1

Gregwar commented 7 years ago

Should be fixed on master, do you confirm it is ok?

chippyash commented 7 years ago

Did you tag it yet so it'll be pulled through in dependencies?

Gregwar commented 7 years ago

Just tagged v1.1.2

chippyash commented 7 years ago

ok - you'll need to bump up your formidable lib to 1.1.1. It currently specifies "gregwar/captcha": "1.0.*", in requires. Could go to "~1.1', that way, it'll pick up any new features in captcha.

Gregwar commented 7 years ago

Bumped

chippyash commented 7 years ago

OK - still no joy. I think it is to do with lack of freetype support. see http://stackoverflow.com/questions/7290958/php-fatal-error-call-to-undefined-function-imagettftext I'll take a look later to see what is missing in my GD mod build. Certainly, your commit will remove any ambiguity.

chippyash commented 7 years ago

I cannot get gd installed with freetype support. Something weird happening with package dependencies in PHP 7.0 and Ubuntu 16.04. This is the root of the problem. The ubuntu package installer will not install Freetype. Not your code. So I think you may close this issue.

Charlyo commented 7 years ago

I don't know if that's you case: https://stackoverflow.com/questions/26493762/yosemite-el-capitan-php-gd-mcrypt-installation

In macOS, treetype is not installed by default.