I just moved a site to a new server running PHP 7. It was originally on PHP 5.4, I believe. The following URL should display an image with a code in it, like a captcha:
http://appreviewhelper.com/static/captcha/GkK9yEiaw6
When that URL is hit, the following code is ran:
$code=rand(1000,9999);
$code = (string)$code;
$_SESSION["code"]=$code;
$im = imagecreate(50, 24);
$bg = imagecolorallocate($im, 238, 238, 238); //background color blue
$fg = imagecolorallocate($im, 85, 85, 85);//text color white
imagefill($im, 0, 0, $bg);
imagestring($im, 5, 5, 5, $code, $fg);
header("Cache-Control: no-cache, must-revalidate");
header('Content-type: image/png');
header("Content-Disposition: inline; filename=captcha.png");
imagepng($im);
imagedestroy($im);
exit();
It was working fine on the old server. I've made sure the PHP GD library is installed and the module has been enabled, and I've verified that over and over... but, still I just get a small, blank image. Any ideas?
Thanks
Edit: Below is output from gd_info() from this site:
array(12) {
["GD Version"]=>
string(5) "2.1.1"
["FreeType Support"]=>
bool(true)
["FreeType Linkage"]=>
string(13) "with freetype"
["GIF Read Support"]=>
bool(true)
["GIF Create Support"]=>
bool(true)
["JPEG Support"]=>
bool(true)
["PNG Support"]=>
bool(true)
["WBMP Support"]=>
bool(true)
["XPM Support"]=>
bool(true)
["XBM Support"]=>
bool(true)
["WebP Support"]=>
bool(true)
["JIS-mapped Japanese Font Support"]=>
bool(false)
}