The image creating part within the Captcha coding on our website is failing to work and I've been task to rectify (as well as update site). Fatal error occurs at: imagecreatetruecolor()
Using Dreamweaver and having configured my Windows XP laptop to act as a testing server, I've installed PHP. Running: <?php echo phpinfo(); ?> works successfully.
Running the following code to test my system (and the probable issue with the hosting company) results in:
// prints e.g. 'Current PHP version: 4.1.1'
echo 'Current PHP version: ' . phpversion();
// prints e.g. '2.0' or nothing if the extension isn't enabled
header ('Content-type: image/png');
$im = @imagecreatetruecolor(120, 20)
or die('Cannot Initialize new GD image stream');
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
"Current PHP version: 5.1.4
Warning: Cannot modify header information - headers already sent by (output started at c:\Inetpub\wwwroot\test\phpinfo.php:3) in c:\Inetpub\wwwroot\test\phpinfo.php on line 8"
Line 8 = header ('Content-type: image/png');
From research, I believe my Current PHP version: 5.1.4 contains a variant of GD 2.x but how can I confirm the GD Version on my Windows machine? Or what PHP code can I run to confirm? Otherwise, please can you suggest why imagecreatetruecolor() fails to run on my laptop, a windows7 laptop also configured to run PHP or our site on the hosting web server?