totally unexplained T_variable error

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

totally unexplained T_variable error

Post by jj_bate »

hey im getting this error:
Parse error: syntax error, unexpected T_VARIABLE ...[]... on line 25:


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

if (!$image) die();


$trans = imagecolorallocate($image, 100, 100, 100);
imagecolortransparent($image, $trans); <---this is line 25

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


For some reason this error comes up when imagecolortransparent($image, $trans); is used
typically its usually a missing semicolon, but not this time...

im at a loss.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: totally unexplained T_variable error

Post by Benjamin »

Can you post the entire script?
jj_bate
Forum Newbie
Posts: 6
Joined: Thu Jun 05, 2008 7:49 pm

Re: totally unexplained T_variable error

Post by jj_bate »

Alright, i dont know what i did, (must have had a bad comma) cause its not giving me that error anymore, however it is giving me this now:


Fatal error: Call to undefined function imagecolorallocate() in ...[]... on line 22
helraizer
Forum Commoner
Posts: 31
Joined: Thu Jun 05, 2008 8:20 pm

Re: totally unexplained T_variable error

Post by helraizer »

jj_bate wrote:Alright, i dont know what i did, (must have had a bad comma) cause its not giving me that error anymore, however it is giving me this now:


Fatal error: Call to undefined function imagecolorallocate() in ...[]... on line 22
Make sure you have the correct GD version, or GD installed and uncommented in php.ini

or make a new file with this:

<?php
var_dump(gd_info());
?>

That'll tell you your GD version and all details.
jj_bate
Forum Newbie
Posts: 6
Joined: Thu Jun 05, 2008 7:49 pm

Re: totally unexplained T_variable error

Post by jj_bate »

checked that out a bit ago:

array(12) { ["GD Version"]=> string(27) "bundled (2.0.34 compatible)" ["FreeType Support"]=> bool(true) ["FreeType Linkage"]=> string(13) "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) }
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: totally unexplained T_variable error

Post by RobertGonzalez »

Can you all please use some bbCode when posting code in the forums? It is there to make reading your code easier. It is simple to use. Just highlight your code and then click the little CODE button in the menu above the text area.
Post Reply