469,625 Members | 1,086 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,625 developers. It's quick & easy.

imagecreate() function is not working and giving fatal error

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
2 2739
pbmods
5,821 Expert 4TB
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
1,584 Expert 1GB
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.

Similar topics

1 post views Thread by Tim | last post: by
9 posts views Thread by Penn Markham | last post: by
1 post views Thread by Cal Lidderdale | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.