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 '.'
Thank you for your help so far

Cheers
Jenny
Moderator: saratogaWX
Code: Select all
$baro = round(str_replace(',', '.', $press)); // convert comma decimal to '.'
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);
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);