Oh I see you posted one just before I.
image merging requires two image resources, so the second image needs to be opened with a createImageFrom* call to get a separate resource. Then you provide the arguments for x/y starting points on the destination, the source' x/y, and width/height arguments (presumably the full image?), and finally the alpha.
If you need to make use of 2 sets of x/y components for a size like you had in the other one, you'll probably need to scale the dot's image resource prior to merging it. I don't think the resize works at a scaling level, but I could be wrong on that.
header('HTTP/1.1 420 Enhance Your Calm');