PHP - string to image only produces black background

Posted by Phil Jackson on Stack Overflow See other posts from Stack Overflow or by Phil Jackson
Published on 2010-04-16T10:19:22Z Indexed on 2010/04/16 10:23 UTC
Read the original article Hit count: 221

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about gd

Related posts about php