• 0

opacity/see through images in php


Question

i cant figure out how to make an image semi transparent/chage its opacity/partially see through...

like if u wanted to put a watermark on an image in php quickly or something.

ive changed the opacity in photoshop, but when i use it in php its not transperant at all. :unsure:

coudl someone plz tell me the trick to this.

Link to comment
https://www.neowin.net/forum/topic/447112-opacitysee-through-images-in-php/
Share on other sites

7 answers to this question

Recommended Posts

  • 0

I'm not exactly sure how you mean, but just so you know, if you're using IE6 it dosen't support .png transparency.

However, if your looking for a CSS method try adding:

style="filter: alpha(opacity=50); -moz-opacity: 0.5;"

inside the <img /> tag. It basically gives the image 50% opacity in mozilla browsers and IE. Of course if the settings aren't for you, you can always play around with it. Hope this helps answer your question in some way.

  • 0

This code will enable alpha transparency for an image created in GD. I know it seems counter-intuitive that the imagealphablending() function is false, but that is correct - true enables "blending" mode which is similar to dithering, and false disables it so each pixel is copied with alpha channel information.

$image_p = imagecreatetruecolor($width, $height);
imagesavealpha($image_p, true);
imagealphablending($image_p, false);

  • 0

if u didnt get what i meant i made an example.

there is two images there, the background and the white rectangle, see how u can see the background through the rectangle?? thats what i want to do in php.

post-114394-1143571927.png

and ill try the other examples and stuff u guys gave me.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.