Jump to content


Image handling

  • Please log in to reply
2 replies to this topic

#1 superpimp

  • Members
  • PipPip
  • Member
  • 24 posts

Posted 06 May 2006 - 03:04 PM

I've got this peace of code that generates a blue image with a white line on it, well it should.

When I try to run it it says this: Fatal error: Call to undefined function imagecreatetruecolor() in C:\wamp\www\test.php on line 5
I checked the PHP manual and there is a function like this and Dreamweaver recognizes it. What should I do?

// set up image 
  $height = 200;
  $width = 200;
  $im = imagecreatetruecolor($width, $height);
  $white = imagecolorallocate($im, 255, 255, 255);
  $blue = imagecolorallocate($im, 0, 0, 64);

// draw on image  
  imagefill($im, 0, 0, $blue);
  imageline($im, 0, 0, $width, $height, $white);
  imagestring($im, 4, 50, 150, 'Sales', $white);

// output image
  header ('Content-type: image/png');
  imagepng ($im);
// clean up 


#2 AndyB

  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 06 May 2006 - 03:34 PM

Do you have the GD library as part of your php installation? From the php manual section on imagecreatetruecolor:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Depending on your PHP and GD versions this function is defined or not. With PHP 4.0.6 through 4.1.x this function always exists if the GD module is loaded, but calling it without GD2 being installed PHP will issue a fatal error and exit. With PHP 4.2.x this behaviour is different in issuing a warning instead of an error. Other versions only define this function, if the correct GD version is installed.[/quote]
Legend has it that reading the manual never killed anyone.
My site

#3 superpimp

  • Members
  • PipPip
  • Member
  • 24 posts

Posted 07 May 2006 - 09:21 AM

I have PHP 5.0 so i guess I'll have to install it. Where can I get it?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users