Hi all.
Trying to put TTF fonts onto an image but all I get out is the image with no text shown!
The code I am using is:
If I use this code:
the text shows up but it is yellow!!
Any advice appreciated before my head becomes shiny smooth with all the hair pulling!!
Cheers
M
Trying to put TTF fonts onto an image but all I get out is the image with no text shown!
The code I am using is:
PHP:
<?php
header("Content-type: image/png");
$im = imagecreatefrompng("images/14.png");
$col = imagecolorallocate($im,255,0,0);
$text = 'Some Text';
$font = 'fonts/arial.ttf';
imagettftext($im, 16, 0, 1, 1, $col, $font, $text);
imagepng($im);
imagedestroy($im);
?>
If I use this code:
PHP:
<?php
header("Content-type: image/png");
$im = imagecreatetruecolor(400, 30);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
$text = 'Testing...';
$font = 'fonts/arial.ttf';
imagettftext($im, 20, 3, 10, 20, $black, $font, $text);
imagepng($im);
imagedestroy($im);
?>
the text shows up but it is yellow!!
Any advice appreciated before my head becomes shiny smooth with all the hair pulling!!
Cheers
M