Zakaria Ghazali
Zakaria Ghazali

Reputation: 57

How to change text color code?

Real Code :

$font_color = ImageColorAllocate($image, 0, 0, 0);
    imagettftext($image, 50, 0, 80, 80, $font_color, '/home/u801961841/public_html/nama.TTF', $user[name]);
    imagettftext($image, 20, 0, 80, 130, $font_color, '/home/u801961841/public_html/nama.TTF', $text3);

I've tried .. but nothing changes. Which code should be changed?

Upvotes: 1

Views: 490

Answers (1)

user1416258
user1416258

Reputation:

Your '$font_color' variable is responsible for the color of text which you're superimposing on the image. Therefore, you should change the 2, 3 and 4th variables in the ImageColorAllocate method to be the respective R G and B values of the color you want.

Follow these examples and you should come to some understanding of what isn't working for you: http://php.net/manual/en/function.imagettftext.php#example-3068

Upvotes: 1

Related Questions