ImageTTFText Question
Posted: Fri Apr 09, 2004 9:45 am
Hi,
This is the basic example of ImageTTFTEXT
I added the variable $color, and I put that into the $red variable.
But for some reason, when i use the $color variable, imagecolorallocate cant read the color value. It just displays the text color as black when it should be red.
Any way to do this?
Thanks.
This is the basic example of ImageTTFTEXT
Code: Select all
<?php
header("Content-type: image/jpeg");
$im = imagecreate(400, 30);
$white = imagecolorallocate($im, 255, 255, 255);
$red = imagecolorallocate($im, 150, 25, 25);
// Replace path by your own font path
imagettftext($im, 20, 0, 10, 20, $red, "/path/arial.ttf",
"Testing... Omega: Ω");
imagejpeg($im);
imagedestroy($im);
?>Code: Select all
<?php
header("Content-type: image/jpeg");
$im = imagecreate(400, 30);
$color = "150, 25, 25";
$white = imagecolorallocate($im, 255, 255, 255);
$red = imagecolorallocate($im, $color);
// Replace path by your own font path
imagettftext($im, 20, 0, 10, 20, $red, "/path/arial.ttf",
"Testing... Omega: Ω");
imagejpeg($im);
imagedestroy($im);
?>Any way to do this?
Thanks.