Sandaysoft

Support forum for Cumulus weather station software
It is currently Fri May 24, 2013 10:29 pm
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  [ 12 posts ] 
Author Message
 Post subject: display range of images on temp ?
PostPosted: Tue May 08, 2012 6:20 am 
Offline
User avatar

Joined: Thu Apr 26, 2012 6:36 am
Posts: 48
Location: Clacton on Sea, Essex
Weather Station: Watson W8681 MK2
Operating System: Win 7
Hi all,
I have searched the site but don't see what I am looking for.
I would like to have a set of images and dependent on the
outside temp a image would be displayed relating to that
on my website. Is there anything like this that will allow
me to have my own set of images ?

Paul

_________________
Image

Weather: http://www.g0hwc.com/weather
Ham Radio: http://www.g0hwc.com
TruckCam: http://www.truckcam.tv


Top
 Profile  
 
 Post subject: Re: display range of images on temp ?
PostPosted: Sun May 20, 2012 4:56 pm 
Offline
User avatar

Joined: Wed Sep 17, 2008 1:34 pm
Posts: 629
Location: Mesa, AZ USA
Weather Station: Davis VP2 Plus w/24 FARS
Operating System: WinX Pro SP3 Dedicated wstn
If you are using PHP, it is pretty easy. You setup an array with the images you want, and then an array to match the temp zones for those images. Grab the current temp value and do a compare and the script then outputs the image file to use for the current temp zone.

Example Live Running script (NOTE that the grey would NOT be output by the script, only the image file so you can insert it into your page):

http://cumulus.tnetweather.com/test/temp_image.php

Code Snippet is below:
Code:
<?php

// Code for getting the current temp not included in snippet

// Range of temps.  The second value is the highest value matched
$RANGE = array();
$RANGE[0][0] = -1;  $RANGE[0][1] = "verycold.jpg";
$RANGE[1][0] = 45;  $RANGE[1][1] = "cold.jpg";
$RANGE[2][0] = 70;  $RANGE[2][1] = "mild.jpg";
$RANGE[3][0] = 90;  $RANGE[3][1] = "warm.jpg";
$RANGE[4][0] = 100; $RANGE[4][1] = "hot.jpg";
$RANGE[5][0] = 110; $RANGE[5][1] = "smokinghot.jpg";

$found = 0;
foreach($RANGE as $key => $val) {
    if ($cur_temp >= $val) {
        $found = $key;
    }
}

echo $IMAGES[$found];
// We be done...

_________________
Kevin
Image
All you need is Time, Aptitude and Desire ... and you can build just about anything...
Cumulus User Maps


Top
 Profile  
 
 Post subject: Re: display range of images on temp ?
PostPosted: Sun May 20, 2012 5:16 pm 
Offline
User avatar

Joined: Thu Apr 26, 2012 6:36 am
Posts: 48
Location: Clacton on Sea, Essex
Weather Station: Watson W8681 MK2
Operating System: Win 7
Hi Kevin,

That looks like just what I want to use but I know nothing about php :|
I guess I need to get my hear around php now.

Thanks again :clap:

Paul

_________________
Image

Weather: http://www.g0hwc.com/weather
Ham Radio: http://www.g0hwc.com
TruckCam: http://www.truckcam.tv


Top
 Profile  
 
 Post subject: Re: display range of images on temp ?
PostPosted: Sun May 20, 2012 6:24 pm 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 2521
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
And the equivalent client side javascript if you do not have access to PHP could be..
Code:
// Range of temps (Farenhiet assumed).  The first value is the highest value matched
var range, len;
range = [
    [-999, "verycold.jpg"],
    [45, "cold.jpg"],
    [70, "mild.jpg"],
    [90,  "warm.jpg"],
    [100, "hot.jpg"],
    [110, "smokinghot.jpg"]];

for (len = range.length; len; len--) {
    if (cur_temp >= range[len][0]) {
        document.getElementById("img_id").src = range[len][0];
        break;
    }
}

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
 Post subject: Re: display range of images on temp ?
PostPosted: Mon Jun 04, 2012 6:28 pm 
Offline
User avatar

Joined: Thu Apr 26, 2012 6:36 am
Posts: 48
Location: Clacton on Sea, Essex
Weather Station: Watson W8681 MK2
Operating System: Win 7
I am now using the Weather Blues templates and found it has this
feture built in. I have now made my own set of Forcast images


Nice to have a bit of FUN with the weather LOL

See what you think?
http://www.g0hwc.com/weather/index.htm

Paul

_________________
Image

Weather: http://www.g0hwc.com/weather
Ham Radio: http://www.g0hwc.com
TruckCam: http://www.truckcam.tv


Top
 Profile  
 
 Post subject: Re: display range of images on temp ?
PostPosted: Mon Jun 04, 2012 6:32 pm 
Offline
User avatar

Joined: Sat Jul 31, 2010 10:34 pm
Posts: 1039
Location: Anglesey, North Wales, UK
Weather Station: Fine Offset
Operating System: Windows XP
You sharing those lol


BRING ON SUNNY WEATHER!

_________________
Rob,
Dyffryn History on WU Dyffryn on Twitter Dyffryn on WOW
Image


Top
 Profile  
 
 Post subject: Re: display range of images on temp ?
PostPosted: Wed Jun 06, 2012 1:08 pm 
Offline
User avatar

Joined: Mon Dec 20, 2010 12:12 pm
Posts: 446
Location: Palmerston, NT, Australia
Weather Station: WS-1081 with rain gauge mod
Operating System: Windows 7 & 1.9.3 b1059
I do a similar thing. For temp I have 6.
I do think you need to crop the pics to the right size. The rain one looked odd (although I have seen the full res version, and she is quite nice.).

_________________
Michael, Palmerston, NT Australia www.Palmerston-WeatherImageNo image? I'm offline!
ImageImageImage


Top
 Profile  
 
 Post subject: Re: display range of images on temp ?
PostPosted: Thu Jun 07, 2012 3:42 pm 
Offline
User avatar

Joined: Thu Apr 26, 2012 6:36 am
Posts: 48
Location: Clacton on Sea, Essex
Weather Station: Watson W8681 MK2
Operating System: Win 7
MickinMoulden Looking at my pages in Firefox and IE the weather images fit the box
just right. What are you viewing my pages in ?

And

robynfali They are very easy to make, just get a bunch of images and
add the weather image over it.

Paul

_________________
Image

Weather: http://www.g0hwc.com/weather
Ham Radio: http://www.g0hwc.com
TruckCam: http://www.truckcam.tv


Top
 Profile  
 
 Post subject: Re: display range of images on temp ?
PostPosted: Fri Jun 08, 2012 7:35 am 
Offline
User avatar

Joined: Mon Dec 20, 2010 12:12 pm
Posts: 446
Location: Palmerston, NT, Australia
Weather Station: WS-1081 with rain gauge mod
Operating System: Windows 7 & 1.9.3 b1059
Paul-G0HWC wrote:
MickinMoulden Looking at my pages in Firefox and IE the weather images fit the box
just right. What are you viewing my pages in ?

Paul

Paul, I'm viewing in IE, but your image is 211x136 but seems that it needs to be wider as there are blue bars down each side.

_________________
Michael, Palmerston, NT Australia www.Palmerston-WeatherImageNo image? I'm offline!
ImageImageImage


Top
 Profile  
 
 Post subject: Re: display range of images on temp ?
PostPosted: Fri Jun 08, 2012 8:48 am 
Offline
User avatar

Joined: Wed Sep 17, 2008 1:34 pm
Posts: 629
Location: Mesa, AZ USA
Weather Station: Davis VP2 Plus w/24 FARS
Operating System: WinX Pro SP3 Dedicated wstn
MickinMoulden wrote:
Paul-G0HWC wrote:
MickinMoulden Looking at my pages in Firefox and IE the weather images fit the box
just right. What are you viewing my pages in ?

Paul

Paul, I'm viewing in IE, but your image is 211x136 but seems that it needs to be wider as there are blue bars down each side.


To fit properly, the image needs to be sized 219x138

That would make it "fill" the entire box used by the forecast

_________________
Kevin
Image
All you need is Time, Aptitude and Desire ... and you can build just about anything...
Cumulus User Maps


Top
 Profile  
 
 Post subject: Re: display range of images on temp ?
PostPosted: Fri Jun 08, 2012 6:02 pm 
Offline
User avatar

Joined: Thu Apr 26, 2012 6:36 am
Posts: 48
Location: Clacton on Sea, Essex
Weather Station: Watson W8681 MK2
Operating System: Win 7
Hi Kevin,

I could not move the image over any more thatn I have so left a small gap each side
I ended up using:
<img src="images/meteo/<#forecastnumber>.png" style="padding: 20px 0px 10px 0px" alt="Forecast icon" title="Forecast icon" />

I did try -10px in the last but negative don't seem to work??

Maybe I should go and have another try to move it left a bit more

Paul

_________________
Image

Weather: http://www.g0hwc.com/weather
Ham Radio: http://www.g0hwc.com
TruckCam: http://www.truckcam.tv


Top
 Profile  
 
 Post subject: Re: display range of images on temp ?
PostPosted: Fri Jun 08, 2012 6:49 pm 
Offline
User avatar

Joined: Thu Apr 26, 2012 6:36 am
Posts: 48
Location: Clacton on Sea, Essex
Weather Station: Watson W8681 MK2
Operating System: Win 7
Just worked it out, This css is new to me.
Just going to adjust all the images


Paul

_________________
Image

Weather: http://www.g0hwc.com/weather
Ham Radio: http://www.g0hwc.com
TruckCam: http://www.truckcam.tv


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 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:  

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