WARNING: I am a complete beginner at php.
I am working on some php code to generate a forum signatures for me. I can merge images together without any issues. And I can also merge text into the image with a transparent background, but when the page finishes loading, I can’t get it to display anything.
[php]
<?php //header ("Content-type: image/png"); textImageMerge("sample string",85,60,15,"VeraBd.ttf",255); function textImageMerge($text,$x,$y,$font_size,$font,$color) { header ("Content-type: image/png"); $image = "images/sig.png"; //YOUR IMAGE $width = imagefontwidth($font_size) * strlen($text) ; $height = imagefontheight($font_size) ; $im = imagecreatefrompng($image); $backgroundColor = imagecolorallocate ($im, 255, 255, 255); $textColor = imagecolorallocate ($im, $color, $color, $color); //imagestring ($im, $font_size, $x, $y, $text, $textColor); imagettftext($im,$font_size,0,$x,$y,$textColor,$font,$text); //put text with a transparent background over image. imagepng($im,$image); //write image to file. imagedestroy($im); return "images/sig.png"; } ?>[/php]
So I am including this file in another page. If I dont call this function, everything else on my other page executes fine and output is displayed. If I call this function, all the correct changes are made to the image (merging images, inserting text…), but I just get a blank screen for output. Maybe something to do with the header (not sure what that does exactly)?