PHP Moon Phase icon generator
Posted: Sun 08 Jun 2014 10:02 pm
I wanted a simple 'clean' looking Moon phase icon for my home, so I took the code to be found on the PHP online manual for imagefilledellipse() and cleaned it up a bit, this just uses a mean lunar period, and linear interpolation to get this....
<Sorry, this script has been deleted>
Not very accurate, so I changed to to use a sin() interpolation to allow for a spherical moon and got this...

Much better, and actually pretty accurate (for this lunation anyway).
Then I used one the 'many' PHP Moon Phase classes for a pretty accurate geocentric solution, and got this...

Very subtly different from the second one, and probably not worth the extra computation.
Veiw the source of any of them with ?view=src
They default to 75x75 pixels with no parameters, and you can provide a transparent=false parameter to get a black background.
Feel free to use the code, I basically got it for free!
<Sorry, this script has been deleted>
Not very accurate, so I changed to to use a sin() interpolation to allow for a spherical moon and got this...
Much better, and actually pretty accurate (for this lunation anyway).
Then I used one the 'many' PHP Moon Phase classes for a pretty accurate geocentric solution, and got this...
Very subtly different from the second one, and probably not worth the extra computation.
Veiw the source of any of them with ?view=src
They default to 75x75 pixels with no parameters, and you can provide a transparent=false parameter to get a black background.
Feel free to use the code, I basically got it for free!