This is my code:
PHP Code:
$text_array = array("Joel""Almeida""García""Joel Almeida García");
$text $text_array[rand(0count($text_array)-1)];

$im imagecreate(5022);
$bgColor imagecolorallocate($im255255255);
$fgColor imagecolorallocate($im,   0,   00);
imagecolortransparent($im$bgColor);
imagestring($im200$text$fgColor);
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im); 
The above code, creates a png image from a random text....my question is: How can I calculate, by code, the corrrect values width and height of imagecreate, based on the returned text?

Thanks