GD Library issue with radius corner


I am using GD Library to reshape my images, as well as add to them.

You can see them here:
the site

I use this below to create the png radius shape:
imagecreatefrompng(’…/images/rounded_corner_40px.png ');

After adding:

$white = ImageColorAllocate($image,255,255,255); $black = ImageColorAllocate($image,0,0,0);

For example to the left corner:

if ($topleft == true) { $dest_x = 0; $dest_y = 0; imagecolortransparent($corner_resized, $black); imagecopymerge($image, $corner_resized, $dest_x, $dest_y, 0, 0, $corner_width, $corner_height, 100); }

It turns the PNG file to Black, then i see the corner with a bit black on the site.

Why did it not stay white as the orginal PNG file?

I hope this made sense.

Thanks :)

I have zero GD experience or knowledge, but could it be caused by the fact that you’re actually setting a global variable to ‘black’ without realizing that it’s global (and as such, fills up the entire PNG file)?

hi there, thanks for the reply.
if i use a different color other than black, it shows me the corners over the actual image.
im not sure what im doing wrong :(

Sponsor our Newsletter | Privacy Policy | Terms of Service