String to image only produces black background
- by Phil Jackson
Hi im really having a problem find how to fix this.
$string = "foo";
$font = 4;
$width = ImageFontWidth($font) * strlen($string);
$height = ImageFontHeight($font);
$im = @imagecreatetruecolor ($width,$height);
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 0);
imagestring($im, 5, 0, 0, $string, $textcolor);
imagegif($im, 'somefile.gif', 8);
imagedestroy($im);
I cannot seem to change the background from black. Does anyone have any ideas?