Jump to content

Image handling


superpimp

Recommended Posts

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?

[code]<?php
// 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
  imagedestroy($im);
?>[/code]

thx!
Link to comment
https://forums.phpfreaks.com/topic/9188-image-handling/
Share on other sites

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]
Link to comment
https://forums.phpfreaks.com/topic/9188-image-handling/#findComment-33849
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.