Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2004
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Image Alpha transparency with GD2 library

    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.

  • #2
    Regular Coder mlse's Avatar
    Join Date
    Mar 2005
    Posts
    624
    Thanks
    20
    Thanked 19 Times in 18 Posts
    Check out imagealphablending: http://uk2.php.net/manual/en/functio...hablending.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).
    Last edited by mlse; 02-19-2008 at 12:12 PM.

  • #3
    New Coder
    Join Date
    Sep 2004
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlse View Post
    Check out imagealphablending: http://uk2.php.net/manual/en/functio...hablending.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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •