I know that the problems with PHP + GD transparency were beaten to death on this and many other sites, but I followed all the recommendations and I canโt fix my problem.
First, the explanation:
I am trying to overlay one image on top of another. Both of them have transparent areas. Since the demo I know should look a certain way, I'm trying to checkmark the blue arrow shape I created.
Here are two images:


Now to my code:
I am using the library / API that I created to remove the TINY bit from image editing using PHP + GD. It is still in its infancy, but the corresponding files are:
Base class
Master bootloader
Combined class (poorly named)
I run the code using the following script:
<?php require_once('Image.php'); header("Content-Type: image/png"); $img = new Image(); $over = new Image(); $img->source = "arrow.png"; $over->source = "chk-done_24.png"; $img->Combine->Overlay($over, 20, 20, 0, 0, $over->width, $over->height); $img->output(); $img->clean(); unset($img); ?>
I expect the result to be something like this:

But instead, I get the following:

I would completely understand the problem if the filled area was white or black , but filling with blue just doesn't make any sense to me.
In the combined class I above, I also tried imagecopy , imagecopyresampled and vanilla imagecopymerge , both with similar results.
I have a complete loss.
Edit:
To be clear, my question is: what part of my code is incorrect? Why does it fill the transparent area with color (instead of black or white) and how can I fix it, while maintaining the ability to merge images with transparency?
Update:
Note that when creating a new image object, it calls newImage , which contains the following code:
$this->handle = imagecreatetruecolor($this->width, $this->height); imagealphablending($this->handle, false); imagesavealpha($this->handle, true);
It seems to me that this is easy to miss.