Page 1 of 1

totally unexplained T_variable error

Posted: Thu Jun 05, 2008 8:00 pm
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.

Re: totally unexplained T_variable error

Posted: Thu Jun 05, 2008 8:06 pm
by Benjamin
Can you post the entire script?

Re: totally unexplained T_variable error

Posted: Thu Jun 05, 2008 8:21 pm
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

Re: totally unexplained T_variable error

Posted: Thu Jun 05, 2008 8:31 pm
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.

Re: totally unexplained T_variable error

Posted: Thu Jun 05, 2008 8:33 pm
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) }

Re: totally unexplained T_variable error

Posted: Fri Jun 06, 2008 12:59 am
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.