By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,402 Members | 1,091 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,402 IT Pros & Developers. It's quick & easy.

imagecreate() function is not working and giving fatal error

P: 1
Hi

I am using PHP 4.3.1 and i have written a little code for purpose of CAPTCHA Image.

i am running this code locally on localhost using IIS 5.0.
When i open the code page, i get an fatal error like:

Here is my code

"
Expand|Select|Wrap|Line Numbers
  1.     header ("Content-type: image/jpeg");
  2.     $img = imagecreate(100,30);
  3.     $black = imagecolorallocate($img, 0, 0, 0);
  4.     $white = imagecolorallocate($img, 255, 255, 255);
  5.     $text = "H6U84S";
  6.     imagestring($img, 14, 5, 5, $text, $white);
  7.     imagejpeg($img,'',100);    //Output Picture
  8.     imagedestroy ($img);    
  9.  
"

And i am having this Fatal Error

Fatal error: Call to undefined function: imagecreate() in C:\Documents and Settings\majeedm\Desktop\Test\test.php on line 2

Can any please help me out.
Jul 9 '07 #1
Share this Question
Share on Google+
2 Replies


pbmods
Expert 5K+
P: 5,821
Heya, lwo3108. Welcome to TSDN!

Betcha that PHP was not compiled with GD support on your system. You can check this by running phpinfo(). Look for '--with-gd' in the configure options, and a section entitled 'GD'. If you don't have either, you'll need to recompile PHP.
Jul 9 '07 #2

ak1dnar
Expert 100+
P: 1,584
Hi me too here, Try this...
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $array = gd_info();
  3. foreach ($array as $key => $val)
  4. {
  5. if ($key != "GD Version") {
  6. if ($val == true || $val == false) {
  7. if ($val == true) {
  8. $val = "Enabled";
  9. }
  10. elseif ($val == false)
  11. {
  12. $val = "Disabled";
  13. }
  14. }
  15. }
  16.  
  17. echo "$key: $val <br>";
  18. }
  19.  
  20. ?>
  21.  
Jul 9 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.