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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.