Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.3.3 (build 4070) - 04 January 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 on an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

CloudBase script for Cumulus Ver CU1.5

Discussion of Ken True's web site templates

Moderator: saratogaWX

User avatar
JennyLeez
Posts: 336
Joined: Wed 16 Dec 2009 2:32 am
Weather Station: La Crosse WS3083
Operating System: Windows XP, Win7 & Win 10
Location: Wairoa, Hawkes Bay. New Zealand.
Contact:

Re: CloudBase script for Cumulus Ver CU1.5

Post by JennyLeez »

The error I am getting is line 382 in both
PHP version 8.0.30

http://wairoa.net/weather/cloudbaseCUmx.php

and
8.1.31

Code: Select all

$baro			= round(str_replace(',', '.', $press));	//	convert comma decimal to '.'
I downloaded the file above you attached and uploaded without changing anything.
Thank you for your help so far :)
Cheers
Jenny
Wairoa, Hawkes Bay, New Zealand Weather Station:
http://wairoa.net/weather/index.htm
Cumulus Topsites:
http://cumulussites.net/
Image
BCJKiwi
Posts: 1259
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: CloudBase script for Cumulus Ver CU1.5

Post by BCJKiwi »

Sorry I am at a loss as to why it works for me and not for you two.
water01
Posts: 3641
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10/11 64bit Synology NAS
Location: Burnham-on-Sea
Contact:

Re: CloudBase script for Cumulus Ver CU1.5

Post by water01 »

I noticed that you do not run all the options, or at least they were not set in the source you posted.

I run all the options

Image

Could that be the problem?
David
Image
User avatar
JennyLeez
Posts: 336
Joined: Wed 16 Dec 2009 2:32 am
Weather Station: La Crosse WS3083
Operating System: Windows XP, Win7 & Win 10
Location: Wairoa, Hawkes Bay. New Zealand.
Contact:

Re: CloudBase script for Cumulus Ver CU1.5

Post by JennyLeez »

Hi water01
Correct I only want the cloud stuff. Like it simple.

I have finally succeeded and it now displays. I am missing the moon but they may be because I have hid a few lines :?
(Beteljuice will be rolling in his grave)

http://wairoa.net/weather/cloudbaseCUmx.php

I have hid 5 lines that threw out error messages as I had no idea how to fix them. Waters01 also had issues with 601 or 602
382
601
602
742
743

That is 1 of 3 issues I have.
I suggest you go on holiday Brian before I put the second SOS up :)

Cheers and thanks :)
Jenny
Wairoa, Hawkes Bay, New Zealand Weather Station:
http://wairoa.net/weather/index.htm
Cumulus Topsites:
http://cumulussites.net/
Image
User avatar
lse-cumulus
Posts: 102
Joined: Mon 11 Jul 2022 3:39 am
Weather Station: Fine Offset Ecowitt
Operating System: Windows 11
Location: Austria
Contact:

Re: CloudBase script for Cumulus Ver CU1.5 and PHP 8.1.x

Post by lse-cumulus »

Hi Jenny,
I will look into all the mentioned lines/issues in more detail and also try to test it out in a PHP 8.1.31 development/debug environment.

But a first fast answer: The problems fall into two (2) groups:
(1) lines 382, 742 and 743: are about typecasting between string/float datatype with function (round)
Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float, string given
That sounds like PHP version dependent.
That should be solveable (theoretically, but I will also make some tests) by typecasts or by skipping the round () function at all. Only unlikely problem could be when in the datastring no numeric data is stored at all during runtime (e.g. $press = "leo").

Code: Select all

// line-382:
// old code: $baro = round(str_replace(',', '.', $press));	
// new code-1:
$baro = (string) round( (float) (str_replace(',', '.', $press)));	
// or new code-2 without rounding:  	$baro = str_replace(',', '.', $press);	

// lines-742-743:
// old code: 	$txtH = round($humidity) . '%'; $sizH = strlen($txtH) * imagefontwidth(3);
// new code-1:
$txtH = ((string) (round((float) $humidity))) . '%';
$sizH = strlen($txtH) * imagefontwidth(3); //after line before is fixed and $txtH is (string) then no change should be required here as strlen() and imagefontwidth() return both (int)
// or new code-2 without rounding: $txtH = $humidity . '%'; $sizH = strlen($txtH) * imagefontwidth(3);

(2) lines 601, 602: here I need more time to investigate in more detail the issues with GD graphics library;
Uncaught TypeError: imagecopyresampled(): Argument #2 ($src_image) must be of type GdImage, bool given
The error is raised in function imagecopyresampled(), but can be a transient error that is propagated from previous function calls to imagerotate() and imagecreatefrompng() as the status variables $image and $rotate are not checked for false. So earlier function calls could have failed, e.g. the $src_file that should contain the moonimage for all phase percentages might not be present on the server location ...
That does not look like PHP version related problem but environment related issue.
Could need some debugging or adding some safety checks to the code ...

Code: Select all

/* old code
	$image = imagecreatefrompng($src_file);
	if ($ns == 'N') {$rotate = $image;} else { $rotate = imagerotate($image, 180, 0);}  
	imagecopyresampled($temp_image, $rotate, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height);
*/
// suggested new code to locate the error:
	$image = imagecreatefrompng($src_file);
	if (!$image) {echo "file $src_file not found";}
	if ($ns == 'N') {$rotate = $image;} else { $rotate = imagerotate($image, 180, 0);}  // sutne
	 if (!$rotate) {echo "cannot rotate image";}
	imagecopyresampled($temp_image, $rotate, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height);
Leo

Ecowitt GW2000/WS90/Wittboy/GW1000/WS2910/WH65/WH31/WH34S/WH41/WH45/WH51/WH57/HP10/WN35/LDS01
AWEKAS/CWOP/PWS/Weathercloud/Windy/WOW/WU/WxSim/CMX/CU
https://leonas.ddns.net/index.html

Image
water01
Posts: 3641
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10/11 64bit Synology NAS
Location: Burnham-on-Sea
Contact:

Re: CloudBase script for Cumulus Ver CU1.5

Post by water01 »

I have found the problem with the imagecreate.

Quite simply it is caused by the gradual upgrading. at some point it was modified to use the CumulusMX Moon Percentage and what was forgotten was where those percentages were held (source) and updating the image libraries to include them in the correct place. Consequently the images cannot be found and the image creation fails.

I have now fixed all of this in this version

Copy this version into your website and add/replace the cb folder in your images directory with this one and all should work according to my testing on PHP 8.1.31.
DJcloudbase.zip
See here https://www.dmjsystems.co.uk/weatherbos/index.php half way down the page.
You do not have the required permissions to view the files attached to this post.
David
Image
User avatar
lse-cumulus
Posts: 102
Joined: Mon 11 Jul 2022 3:39 am
Weather Station: Fine Offset Ecowitt
Operating System: Windows 11
Location: Austria
Contact:

Re: CloudBase script for Cumulus Ver CU1.5

Post by lse-cumulus »

Jenny,
David found the problem with the imagecreate and provided a fix.

I could verify that the code changes for $baro and $txtH are working under PHP 8.1.31. But these workarrounds are only needed when the strings $press and $humidity are containing no numeric values, like for example an empty string "". In previous PHP versions the round () function was tolerant and calculated 0, with PHP 8.1 the round () function now would return a TypeError.
I think in your environment $press and and $humidity have been empty (as you are not using these options) and therefore you got the problem when upgrading to PHP 8.1.
You can use code-1 or code-2 workarround or you could simply add hardcoded values like $humidity=0;
The cloudbase php scripts has builtin test functions that show that $humidity is indeed emtpy in your environment.
https://wairoa.net/weather/cloudbaseCUmx.php?html=1
Leo

Ecowitt GW2000/WS90/Wittboy/GW1000/WS2910/WH65/WH31/WH34S/WH41/WH45/WH51/WH57/HP10/WN35/LDS01
AWEKAS/CWOP/PWS/Weathercloud/Windy/WOW/WU/WxSim/CMX/CU
https://leonas.ddns.net/index.html

Image
User avatar
JennyLeez
Posts: 336
Joined: Wed 16 Dec 2009 2:32 am
Weather Station: La Crosse WS3083
Operating System: Windows XP, Win7 & Win 10
Location: Wairoa, Hawkes Bay. New Zealand.
Contact:

Re: CloudBase script for Cumulus Ver CU1.5

Post by JennyLeez »

Good morning,

I note watero1 did not change the code so I was at 2 odds as to which way to go.
So I decided to change the code to Leo's which is now running without errors.
I deleted and uploaded water01 CB folder and will now wait until tonight to see if the moon appears, the whole 3% of it .. lol

Many many thanks to you both for your help :)

Cheers
Jenny
Wairoa, Hawkes Bay, New Zealand Weather Station:
http://wairoa.net/weather/index.htm
Cumulus Topsites:
http://cumulussites.net/
Image
User avatar
JennyLeez
Posts: 336
Joined: Wed 16 Dec 2009 2:32 am
Weather Station: La Crosse WS3083
Operating System: Windows XP, Win7 & Win 10
Location: Wairoa, Hawkes Bay. New Zealand.
Contact:

Re: CloudBase script for Cumulus Ver CU1.5

Post by JennyLeez »

Good Evening,

So 2% moon is not showing so I will have to wait for a few days :)

The cloudbase image initially did not load. I did not have Nmoonpct.png
so I changed Nmoon0pct.png and that fixed it.
But that of course is the northern Herm. and I am going to need the southern herm.
I will touch base with Leo tomorrow. Right now bed is calling.

I also had to use the lines above for 601 and 602 that Leo changed.

This upgraded script ( when finished ) needs to be placed on the first page for anyone else needing it for 8.1.31. otherwise like many of the scripts I have been searching for, these changes will become lost in between the never increasing pages.
I will see what Brian thinks.

Cheers
Jenny
Wairoa, Hawkes Bay, New Zealand Weather Station:
http://wairoa.net/weather/index.htm
Cumulus Topsites:
http://cumulussites.net/
Image
Post Reply