Sandaysoft

Support forum for Cumulus weather station software
It is currently Sat May 25, 2013 9:14 am
Please click here before posting. Help me to help you!
Useful Links: Cumulus FAQ • Enhancement requests • Wiki (documentation)
Please put your approximate location into your profile
Add your web site to the Cumulus user map
Vantage Pro2 users with firmware 3.00 should upgrade to fw 3.12 and Cumulus 1.9.4

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: PHP5+ light / dark forecast icon switcher
PostPosted: Wed Aug 08, 2012 3:11 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1852
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
Utility to switch between a set of light / dark forecast icons with a user set 'lead' time

PHP / html Level: beginner => Intermediate

IMPORTANT ***
Your server MUST be running PHP ver 5+ and if 'safe_mode' exists it should be "off".
If you are unsure of the above, unzip and run the following file in your webspace:
Attachment:
fdebug.zip
If it suggests that safe_mode is enabled, check your web space control panel / settings and see if you can turn it "off", else contact your support.
If they say "Oh no can't do that its insecure", tell them its caused so much problems that it is depreciated in ver 5.3 and doesn't even exist in ver 5.4 ! - give them this link: http://uk.php.net/manual/en/features.safe-mode.php

You will also need a 'library' of day / night icons with the correct naming format such as available from jacquesD - if you are unable to fufil the requirements the prog should just return the 'light' version icon.
The naming convention and <#webtag> alternative using <#isdaylight> is discussed HERE

OK so far :lol: - enough scary stuff

Functionality:
The code 'pretends' to be a graphic and will accept time and forecast via a <#webtag> (Template) type page OR realtime.txt if you are uploading that. If no (report) time is forwarded it will assume 'now'.
It artifically advances the next twilight event by user defined number of hours (default 4)
In order to do this correctly you must set your timezone, longitude and latitude.
This also means that it should work in any town in the world at any time of year (think light or dark varying between minutes and months !)
If a (report) time has been forwarded and is older than 7 hours (can be set by user) then N/A icon graphic will be displayed.

V1.0 - August 2012
    Initial release

Attachment:
ficon.zip

View Code:

Unzip the file and using a txt editor like Notepad++ change the user setting to your locale and upload to your web space - double-check you have the correct paths for your icons and (if used) realtime.txt (don't forget to upload icons if you haven't done so already ;) )

Usage:
minimal html coding for Template using <#webtag>s
Code:
<!-- prefered, using report timestamp -->
   <img src="ficon.php?fno=<#forecastnumber>&event=<#date format="yyyy'-'mm'-'dd'*'hh:nn">" />

<!-- using 'now' timestamp --> 
   <img src="ficon.php?fno=<#forecastnumber>" /> 
minimal html coding if using realtime.txt
Code:
   <img src="ficon.php" />


I haven't been able to test this using <#webtag>s - I expect a lot of posts :shock: :lol: :lol:


You do not have the required permissions to view the files attached to this post.

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
 Post subject: Re: PHP5+ light / dark forecast icon switcher
PostPosted: Wed Aug 08, 2012 4:29 pm 
Offline
User avatar

Joined: Sat Jul 03, 2010 9:03 pm
Posts: 156
Location: Lake Zurich, IL; USA
Weather Station: Davis Vantage Pro 2
Operating System: Windows 7
On my website, all of my forecast icons are numbered with three parameters: <#lowtempalarm>_<#isdaylight>_<#forecast>.png. The <#lowtempalarm> tag will allow me to replace raindrop icons with snowflake icons.

I put in an enhancement request so I can replace <#lowtempalarm> with a proposed new tag: <#isfreezing>.

Other than doing lots of duplication of forecast icons, it's worked quite well...

-Tom

_________________
Tom Keramidas, Lake Zurich, IL, USA
Image


Top
 Profile  
 
 Post subject: Re: PHP5+ light / dark forecast icon switcher
PostPosted: Wed Aug 08, 2012 4:35 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 02, 2008 6:49 pm
Posts: 17613
Location: Sanday, Orkney
Weather Station: Davis VP2
Operating System: Windows Home Server 2011
krmidas wrote:
I put in an enhancement request so I can replace <#lowtempalarm> with a proposed new tag: <#isfreezing>.

Aha! I knew that I had lost a small change that I did last Wednesday night due to my hard disk crash on Thursday morning (my backup takes place at around midday each day) but I couldn't remember what it was, and you've now reminded me. I'll put it back in for next build.

_________________
Steve
Sanday Weather
----------------------------------------------------------------------------------------------------------------------------------
Like Cumulus and want to support it? Please donate! Image


Top
 Profile  
 
 Post subject: Re: PHP5+ light / dark forecast icon switcher
PostPosted: Wed Aug 08, 2012 4:46 pm 
Offline
User avatar

Joined: Sat Jul 03, 2010 9:03 pm
Posts: 156
Location: Lake Zurich, IL; USA
Weather Station: Davis Vantage Pro 2
Operating System: Windows 7
Ha! When you posted the zip file yesterday that contained the enhancement to the Davis Transmitter Status tags, I quietly looked to see if, by chance, <#isfreezing> delivered a value. I was afraid of nagging!

Thanks, Steve!

_________________
Tom Keramidas, Lake Zurich, IL, USA
Image


Top
 Profile  
 
 Post subject: Re: PHP5+ light / dark forecast icon switcher
PostPosted: Wed Aug 08, 2012 8:41 pm 
Offline

Joined: Mon Aug 10, 2009 10:16 pm
Posts: 1770
Location: World...
Weather Station: No weather station
Operating System: No operating system
beteljuice wrote:
...tell them its caused so much problems that it is depreciated in ver 5.3 and doesn't even exist in ver 5.4 !
beteljuice, I learned something new from you ... I have heard that a car could depreciate rapidly (as in quickly loosing its original value) ... but I had never heard nor read that a PHP feature could 'depreciate'... :mrgreen:

Not to question (nor criticise) you ideas behind the code, but why make it so ... how should I put it ... complexe? :|

Could a few of the Cumulus produced web tags not been used to produce similar results?

But, but, there is something missing in the code ... the detection of the seasons ... so the length of the days can be adjusted accordingly... :D


Top
 Profile  
 
 Post subject: Re: PHP5+ light / dark forecast icon switcher
PostPosted: Wed Aug 08, 2012 9:21 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1852
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
gemini06720 wrote:
Could a few of the Cumulus produced web tags not been used to produce similar results?
No .... there are no astronomical tags for a future (after midnight) event, so there is nothing to make a comparisson against. To some degree the same thing happens with the php function but I can cycle through to find the 'next' event.
Quote:
But, but, there is something missing in the code ... the detection of the seasons ... so the length of the days can be adjusted accordingly... :D
:?: I don't understand, (especially if taking a 'global' view). For any location at any time, the hours of 'light' and 'dark' are known to within a few minutes given the limitations of the approximating formula and local atmospheric conditions. Not only that, it auto adjusts for any local DST.

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group