Jump to content
xisto Community
Sign in to follow this  

Imagettftext() With Transparency in PHP

Recommended Posts

I have used <img src="blah.php"> to use the PHP image functions to create a gif to display. My problem comes in when I use imagettftext() to display text generated in the php script. I want the text to be semi-transparent and used (correctly I believe)

$back = imagecolorallocatealpha($image, 0, 0, 0, 100);$textcolor = imagecolorallocatealpha($image, 0, 0, 255, 60);
to create the color ($text) that I want. The problem is that the code, imagettftext($image, 70, 0, 0, 96, $text, "/font/arial.ttf", $string); displays the text in the proper RGB color but lacking the transparency.

This is an example of what the image currently looks like (it is random text):

Posted Image


Another thing, is it possible to return the generated random text to the calling php script, or pass the text from the calling php script to the image php script without using post (and preferably without get too)?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.