php - Make Image with Text Function Not Working -


i'm trying create images text on them. here function have created:

function maketitleimage($text){   $im = imagecreatetruecolor(160,160);   $background_color = imagecolorallocate($im,154,205,50);   $text_color = imagecolorallocate($im,255,255,255);   imagefill($im,0,0,$background_color);   imagettftext($im,10,0,0,$text_color,"./asansblack.ttf",$text);   header('content-type: image/png');   imagepng($im,($text.'.jpg'));   imagedestroy($im); } 

this creates 160x160px image background colour no text, named appropriately (so know $text being passed in correctly). path .ttf file accurate. not sure else going on? silly.

thanks!

your imagettftext function missing parameter, y-coordinate of text. try like

imagettftext($im,10,0,0,10,$text_color,"./asansblack.ttf",$text); 

Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -