I'll explain a bit of my situation.
We got an island with cities. These could be:
- Owned by my alliance
- Owned by an enemy
- Owned by nobody (free)
So we got 3 "cities"-images and an island image, looks like this:
Now we want to put these cities images on the island image. For example, we put a city owned by nobody on the island like this:
<?php
// Get image
$im = imagecreatefrompng('island.png');
imagealphablending($im,true);
// Get our "Free-city-position" image
$stamp = imagecreatefrompng('free.png');
$pos_x = 190 - 15; // Position X = 190 - the half of the free.png image = 30 / 2 = 15
$pos_y = 225 - 15;// Position Y = 225 - the half of the free.png image = 30 / 2 = 15
imagealphablending($stamp,true);
imagecopy($im, $stamp, $pos_x, $pos_y, 0, 0, imagesx($stamp), imagesy($stamp));
// Output image
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
And now there is our problem: The city image is not transparent on the island image! It looks like this:
I thought imagealphablending
should do the trick, but unfortunately, it doesn't.
How can we get the transparant city image on the island?