Page 2 of 7

Re: Moon Phases

Posted: Wed 16 Sep 2015 4:00 pm
by water01
nitrx wrote:Can't you change the name of the images to the text ?
That won't work as I would have to have file named for each different image by each language which could get a bit horrendous!!

But I have solved it for all languages by using #MoonPercent and this table as suggested by Laurent.

New Moon 0% - 1%
Waxing Crescent 1% - 49%
First Quarter 49% - 50%
Waxing Gibbous 51% - 99%
Full Moon 99% to 100%
Waning Gibbous -99% to -51%
Last Quarter -50% to -49%
Waning Crescent -49% to -1%

So I have posted the new version in my original first release post (post 10 on Topic Page 1), this version should work for all MX users regardless of language. As always let me know if any problems and I will endeavour to fix them.

Re: Moon Phases

Posted: Wed 16 Sep 2015 8:17 pm
by willyweather
Hi Water01,

thanks for the script - I'm just installing it right now.

One problem happens to me:

On my web page (created by Cumulus MX 3030 on a RasPi) there is no Moon-picture at all (has never been from the beginning).
I assume, that therefore there is simply no line that reads –

<td rowspan="3"><img src="images/moon.bmp" alt="Moon" width="64" align="left" border="0" height="64" style="margin: 0px 10px" /></td>

... at least I can't find it.

Where shall I put the line

<td rowspan="3"><img src="moonphase.php" alt="Moon" width="64" align="left" border="0" height="64" style="margin: 0px 10px" /></td>

in my indexT.htm ?

regards,

Wilfried

p.s.: Just for clarification a second question:

"... and the directory (directory not the contents)"

does mean:

"... and the complete directory "moon"(complete directory not only the contents)" right ?

Re: Moon Phases

Posted: Wed 16 Sep 2015 8:54 pm
by beteljuice
@David ...

Just had a quick look-see at your script. What do you do about the Southern hemisphere where the image needs to be 'mirrored' ? :groan:

Re: Moon Phases

Posted: Wed 16 Sep 2015 9:33 pm
by water01
willyweather wrote:Hi Water01,


Where shall I put the line
<td rowspan="3"><img src="moonphase.php" alt="Moon" width="64" align="left" border="0" height="64" style="margin: 0px 10px" /></td>

in my indexT.htm ?

regards,

Wilfried

p.s.: Just for clarification a second question:

"... and the directory (directory not the contents)"

does mean:

"... and the complete directory "moon"(complete directory not only the contents)" right ?
The line needs to go after

Code: Select all

<td class="site_data" style="text-align: left;"><#moonrise></td>
Hadn't realised because I do not use the CumulusMX web files (mine is a PHP site) that Steve had removed the moon phase image. If you look here http://www.dmjsystems.co.uk/weather/index.php you can see it in action!!

Yes that is right about the Directory, your English is more correct I will alter my Word Doc.

Re: Moon Phases

Posted: Wed 16 Sep 2015 11:09 pm
by water01
beteljuice wrote:@David ...

Just had a quick look-see at your script. What do you do about the Southern hemisphere where the image needs to be 'mirrored' ? :groan:
Sigh, once you start these things you never think of all the likely permutations!!

So here is an updated version that should work in the Southern hemisphere (if I have understood mirroring right i.e. when we see waxing you see waning) and the Northern hemisphere.

Note for those of you who have already installed it there is an extra parameter in moonphasetagT.txt ($latitude) so you will have to copy that to the correct place (as in the Word doc in the zip) to get this to work otherwise you will get a PHP error or no image. You could also, if you are happy with the previous version just ignore this update as this is only to fix the Southern Hemisphere problem.

It has been pointed out I ought to have the new version always in the original post of this code's Topic so I have removed it and the latest version is in post 10 on Topic Page 1.

Re: Moon Phases

Posted: Thu 17 Sep 2015 10:25 pm
by water01
OK as per previous post I have updated the package in page 1 post 10 again as it was pointed out what I had done for the Southern Hemisphere wasn't exactly correct.

So there is an updated moonphase.php plus a new Moon directory containing 6 mirrored images of the waxing/waning/quarter phases mirrored for the Southern Hemisphere. So if you want that you must upload and overwrite the old moon directory with the new one.

Re: Moon Phases

Posted: Fri 18 Sep 2015 7:02 pm
by willyweather
Hi David,
thanks for giving me the right position in the original indexT.htm - worked perfectly.

However, I ran into another, more severe problem - my website doesn't support php at all :o
I didn't know that before and just learned that from my provider.
Now I'm looking for other ways to do the job ...
The logic itself looks not too complicated (I'm an "older" SW-engineer and can read and basically understand the content of the file moonphase.php), but I don't have a clue about php, HTML or Java (that was after my time ;)

Does anyone have any hints how to change the php script method to e.g. an html or Java script?

regards,

Wilfried

Re: Moon Phases

Posted: Fri 18 Sep 2015 11:22 pm
by Ned
If the images are mirrored (i.e back to front) that will not give correct results for the southern hemisphere - it's simply rotated 180 degrees.
We can see how the 'other half' sees the moon by standing on our heads, although I'm not advising anyone to do that literally :D

Re: Moon Phases

Posted: Sat 05 Dec 2015 1:23 am
by richard_newberry
I've got a problem with this. I've done everything as instructed but i'm getting this in apache2 error logs.

[Sat Dec 05 01:14:34.430652 2015] [:error] [pid 10264] [client 86.184.218.138:1028] PHP Warning: copy(moon/moon.jpg): failed to open stream: Permission denied in /var/www/moonphase.php on line 37, referer: http://kirbymuxloe-weather.dyndns.org/index.htm

Any ideas?

Re: Moon Phases

Posted: Sat 05 Dec 2015 8:34 am
by water01
The permissions on /moon are incorrect so the file copy cannot be done.

Try sudo chmod /moon 777 to open up the permissions.

Re: Moon Phases

Posted: Sat 05 Dec 2015 11:18 am
by richard_newberry
Nope still getting the same message

[Sat Dec 05 11:16:54.212597 2015] [:error] [pid 18013] [client 86.184.218.138:1027] PHP Warning: copy(moon/moon.jpg): failed to open stream: Permission denied in /var/www/moonphase.php on line 37, referer: http://kirbymuxloe-weather.dyndns.org/

Re: Moon Phases

Posted: Sat 05 Dec 2015 11:25 am
by freddie
richard_newberry wrote:Nope still getting the same message

[Sat Dec 05 11:16:54.212597 2015] [:error] [pid 18013] [client 86.184.218.138:1027] PHP Warning: copy(moon/moon.jpg): failed to open stream: Permission denied in /var/www/moonphase.php on line 37, referer: http://kirbymuxloe-weather.dyndns.org/
Have you checked the permissions of the file moon.jpg? i.e that the user that is running PHP (likely to be the same user that runs the web server) has read and write permission on moon.jpg. You could try (after changing directory to where the file lives):

Code: Select all

chmod 666 moon.jpg

Re: Moon Phases

Posted: Sat 05 Dec 2015 11:30 am
by water01
Whoops got the syntax wrong.
Try sudo chmod /moon 777
should have been
Try sudo chmod 777 /moon
Also try Freddie's suggestion as it is PHP that has not got permissions to copy the file.

Re: Moon Phases

Posted: Sat 05 Dec 2015 11:42 am
by richard_newberry
working now cheers.

Re: Moon Phases

Posted: Thu 10 Dec 2015 6:41 pm
by richard_newberry
[Contents deleted due to false security alert]