tags:

views:

114

answers:

2

I am attempting to make a dynamic image with PHP, and I can't find out how to set partial transparency. It is very easy to make things either solid or fully transparent, but I have been unable to do this.

+1  A: 

Assuming you're creating your image with the imagecreatetruecolor function and that you're outputting the image as a PNG file....

You need to call the following methods to specify that the image must be generated as a 24-bit PNG before calling imagepng:

imagesavealpha($im, true);

Note that Internet Explorer 6 doesn't support 24-bit PNG files without the use of a CSS filter applied to the img tag.

Jon Benedicto
A: 

Check out the documentation for imagecolorallicatealpha() There they create a transparent color circle.

Ólafur Waage