Guys .....
The topic title says "Manipulate moon.bmp with PHP"
So ..
It's a PHP based script.
It's dealing with an already 'calculated' and uploaded Cumulus image.
Yes ..
You could incorporate a duplication of moon almanac code just to overlay textual information on the image (Always looks sharper and better on the 'page' rather than the image I think), and in that case Lat / Long, and for rise/set the Local difference to GMT (including any DST etc.) - then the possible argument of if the calc is realtime or last site observed time, and .... let's not go there
(There is already a famous site where you can obtain current moon at what ever size you declare with or without blue 'dark' tint

)
Tinted moon colour is not user defined (It is a pre-tinted full moon image with 'current' moon overlayed on top) - It
should be possible, but the beteljuice has been getting lost with PHP layered ideas of transparency, not least of which it should be applied to a 'layer'
after it has been copied to the canvass
With total transparency, N/S doesn't need to be defined because it simply makes the (correctly orientated) Cumulus moon black colour transparent, however; with user defined 'dark' option or tinted option moon, it is necessary to apply the correct (eccentric) mask.
For simplicity (and size) I elected to 'limit' output type to .png
Thought on total transparency, On a new moon there would be nothing to see
I have half toyed with the ideas of either small overlayed graphics or even animation to depict rising or falling / waxing or waning but this again goes beyond the original intent to simply 'modify' the image and naturally increases the code and additionally requires either posting or look-up data.
Here is the result of transparent bounding box and user defined off-black 'dark' fill (r1, b0, g0)
off-black.png
Edit:
I really really like the resolution and the subdued colours of the northern hemisphere moon image I posted in a previous message - unfortunately, I could not find such a high quality image for the southern hemisphers...

Just stand on your head (ie. flip and mirror), although if one was pedantic, you should really calculate the apparent 'tilt' to the observed location - ever thought how it looks at the equator ? - waxes / wanes 'South' / 'North' !