Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

PHP Moon Phase icon generator

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

PHP Moon Phase icon generator

Post by mcrossley »

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...
Image
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...
Image
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!
Post Reply