Welcome to the Cumulus Support forum.

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

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.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

display range of images on temp ?

Discussion and support for 3rd-party (non-Sandaysoft) tools for Cumulus
Post Reply
User avatar
Paul-G0HWC
Posts: 56
Joined: Thu 26 Apr 2012 6:36 am
Weather Station: Davis Vantage Vue
Operating System: Win 7
Location: Clacton on Sea, Essex
Contact:

display range of images on temp ?

Post by Paul-G0HWC »

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 Live video and tracking from my truck
TNETWeather

Re: display range of images on temp ?

Post by TNETWeather »

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: Select all

<?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...
User avatar
Paul-G0HWC
Posts: 56
Joined: Thu 26 Apr 2012 6:36 am
Weather Station: Davis Vantage Vue
Operating System: Win 7
Location: Clacton on Sea, Essex
Contact:

Re: display range of images on temp ?

Post by Paul-G0HWC »

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 Live video and tracking from my truck
User avatar
mcrossley
Posts: 12695
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: display range of images on temp ?

Post by mcrossley »

And the equivalent client side javascript if you do not have access to PHP could be..

Code: Select all

// 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;
    }
}
User avatar
Paul-G0HWC
Posts: 56
Joined: Thu 26 Apr 2012 6:36 am
Weather Station: Davis Vantage Vue
Operating System: Win 7
Location: Clacton on Sea, Essex
Contact:

Re: display range of images on temp ?

Post by Paul-G0HWC »

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 Live video and tracking from my truck
User avatar
robynfali
Posts: 1076
Joined: Sat 31 Jul 2010 10:34 pm
Weather Station: Vantage Vue
Operating System: Windows XP
Location: Anglesey, North Wales, UK
Contact:

Re: display range of images on temp ?

Post by robynfali »

You sharing those lol


BRING ON SUNNY WEATHER!
User avatar
MickinMoulden
Posts: 499
Joined: Mon 20 Dec 2010 12:12 pm
Weather Station: WS-1081 with rain gauge mod
Operating System: Windows 7 & 1.9.3 b1059
Location: Palmerston, NT, Australia
Contact:

Re: display range of images on temp ?

Post by MickinMoulden »

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!
ImageImage
User avatar
Paul-G0HWC
Posts: 56
Joined: Thu 26 Apr 2012 6:36 am
Weather Station: Davis Vantage Vue
Operating System: Win 7
Location: Clacton on Sea, Essex
Contact:

Re: display range of images on temp ?

Post by Paul-G0HWC »

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 Live video and tracking from my truck
User avatar
MickinMoulden
Posts: 499
Joined: Mon 20 Dec 2010 12:12 pm
Weather Station: WS-1081 with rain gauge mod
Operating System: Windows 7 & 1.9.3 b1059
Location: Palmerston, NT, Australia
Contact:

Re: display range of images on temp ?

Post by MickinMoulden »

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!
ImageImage
TNETWeather

Re: display range of images on temp ?

Post by TNETWeather »

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
User avatar
Paul-G0HWC
Posts: 56
Joined: Thu 26 Apr 2012 6:36 am
Weather Station: Davis Vantage Vue
Operating System: Win 7
Location: Clacton on Sea, Essex
Contact:

Re: display range of images on temp ?

Post by Paul-G0HWC »

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 Live video and tracking from my truck
User avatar
Paul-G0HWC
Posts: 56
Joined: Thu 26 Apr 2012 6:36 am
Weather Station: Davis Vantage Vue
Operating System: Win 7
Location: Clacton on Sea, Essex
Contact:

Re: display range of images on temp ?

Post by Paul-G0HWC »

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 Live video and tracking from my truck
Post Reply