fatal error: Unidentified function: imagecolorallocate()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jj_bate
Forum Newbie
Posts: 6
Joined: Thu Jun 05, 2008 7:49 pm

fatal error: Unidentified function: imagecolorallocate()

Post by jj_bate »

I am getting this fatal error when i use this function:
imagecolorallocate()

does it have to do with my GD version?

Heres the GD info ( using var_dump(gd_info()); )
["GD Version"]=> "bundled (2.0.34 compatible)"

["FreeType Support"]=> bool(true)
["FreeType Linkage"]=> "with freetype"
["T1Lib Support"]=> bool(false)
["GIF Read Support"]=> bool(true)
["GIF Create Support"]=> bool(true)
["JPG Support"]=> bool(true)
"PNG Support"]=> bool(true)
["WBMP Support"]=> bool(true)
["XPM Support"]=> bool(false)
["XBM Support"]=> bool(true)
["JIS-mapped Japanese Font Support"]=> bool(false) }


Am i missing something?
jj_bate
Forum Newbie
Posts: 6
Joined: Thu Jun 05, 2008 7:49 pm

Re: fatal error: Undefined function: imagecolorallocate()

Post by jj_bate »

i meant to type undefined, not unidentified... :roll:
dbemowsk
Forum Commoner
Posts: 82
Joined: Wed May 14, 2008 10:30 pm

Re: fatal error: Unidentified function: imagecolorallocate()

Post by dbemowsk »

Post your code and the exact error you are getting.
jj_bate
Forum Newbie
Posts: 6
Joined: Thu Jun 05, 2008 7:49 pm

Re: fatal error: Unidentified function: imagecolorallocate()

Post by jj_bate »

Fatal error: Call to undefined function imagecolorallocate() in .../generateTrans.php on line 12

<?php

var_dump(gd_info());

$file = "test123.png";

$imagesource = "$file";
$image = imagecreatefrompng($imagesource);

if (!$image) die();

$trans = imageColorAllocate($image, 100, 100, 100);


imageColorTransparent($image, $trans);

imagepng($image, "testing123.png");
imagedestroy($image);

?>
helraizer
Forum Commoner
Posts: 31
Joined: Thu Jun 05, 2008 8:20 pm

Re: fatal error: Unidentified function: imagecolorallocate()

Post by helraizer »

jj_bate wrote:Fatal error: Call to undefined function imagecolorallocate() in .../generateTrans.php on line 12

<?php

var_dump(gd_info());

$file = "test123.png";

$imagesource = "$file";
$image = imagecreatefrompng($imagesource);

if (!$image) die();

$trans = imageColorAllocate($image, 100, 100, 100);


imageColorTransparent($image, $trans);

imagepng($image, "testing123.png");
imagedestroy($image);

?>
if you have access to it, check to see if the gd extension is uncommented in php.ini - if it's commented then uncomment it and restart apache/the server.
Post Reply