...

View Full Version : Image Alpha transparency with GD2 library



heals1ic
02-19-2008, 12:56 PM
Can anyone tell me if it is possible to change an images' alpha transparency with the php GD2 library?

My aim is to upload an image (jpg, bmp, gif, png) to the webserver and fade it to 50% transparency and save it to a folder on the server as a gif or png image file.

mlse
02-19-2008, 01:09 PM
Check out imagealphablending: http://uk2.php.net/manual/en/function.imagealphablending.php. If you want transparency in the web page itself, you can only reliably do that in the HTML (FF and IE7 support PNG transparency, IE6 doesn't).

heals1ic
02-21-2008, 12:48 PM
Check out imagealphablending: http://uk2.php.net/manual/en/function.imagealphablending.php. If you want transparency in the web page itself, you can only reliably do that in the HTML (FF and IE7 support PNG transparency, IE6 doesn't).

The image is intended to be displayed in the background with css repeated and an image in the foreground in an img tag.

The foreground and background images are dynamic based on database results with the foreground image to stand out from the background which is why I want to fade the alpha of the background image.

Can you give me an example of some code to alter the png's transparency?

The only examples I can get a hold of are for merging images.

Cheers



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum