Author Topic: Ajax Thermometer Image Color Fill Issue  (Read 812 times)

0 Members and 1 Guest are viewing this topic.

Offline scudwatcher

  • Billy T. Forecaster Webmaster csraweather.net
  • Senior Contributor
  • ****
  • Posts: 157
  • Amateur Radio KC4SRA csraweather.net
    • CSRA Weather
Ajax Thermometer Image Color Fill Issue
« on: March 02, 2023, 05:05:57 PM »
Gentlemen,
  I have added a thermometer.php script (old) to my webserver to enhance the "fill" area with different temperature colors.  The image is "thermometer-blank2.png".  I have checked the settings in my webserver thermometer.php:

$UOM = 'F';              // set to 'C' for Celsius/Centigrade, 'F'=Fahrenheit
$wxSoftware = 'WD';      // set to 'VWS' to use VWS WeatherFlash files
$autoScale  = true;      // set to false to disable autoscale.
$showTempOnBulb = false; // show current temperature on bulb
$showUOMonBulb  = false; // show UOM on bulb (overrrides $showTempOnBulb)

// relative file address for thermometer blank image PNG
$BlankGraphic  = './thermometer-blank2.png'; // blank0=red, blank1=blue, blank2=gradient, blank3=old style

I observe a weird coding above the thermometer "d0 (superscript)z"F at: https://csraweather.org

I have really researched the WxForum database and could someone please direct me to the proper message thread or the instructions to correct the UOM issue?  Is this a WD or ajax-dashboard issue?  Thank You in advance!


Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Ajax Thermometer Image Color Fill Issue
« Reply #1 on: March 02, 2023, 05:30:20 PM »
You're using the Bashewa thermometer script.  The line with the problem is
Code: [Select]
   $cnt = '�' . $UOM;
  The odd character is likely a UTF8 degree sign, and with the built-in fonts, it needs to be an ISO-8859-1 degree sign.

You can change that line to what I use in the stock thermometer.php to ensure a degree sign is used
Code: [Select]
    $cnt = chr(176) . $UOM; // chr(176) = degree sign in ISO-8859-1
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline scudwatcher

  • Billy T. Forecaster Webmaster csraweather.net
  • Senior Contributor
  • ****
  • Posts: 157
  • Amateur Radio KC4SRA csraweather.net
    • CSRA Weather
Re: Ajax Thermometer Image Color Fill Issue- SOLVED!
« Reply #2 on: March 02, 2023, 05:37:31 PM »
Thank You for all you do, Ken!

Offline scudwatcher

  • Billy T. Forecaster Webmaster csraweather.net
  • Senior Contributor
  • ****
  • Posts: 157
  • Amateur Radio KC4SRA csraweather.net
    • CSRA Weather
Re: Ajax Thermometer Image Color Fill Issue
« Reply #3 on: March 03, 2023, 06:28:27 AM »
Gentlemen,
  Ultimately, I am in the process of updating all my website scripts to upgrade to PHP 8.2.  When I run Ken's updated PHP 8.2 thermometer script, I am viewing an image white background: https://csraweather.org

I scrolled down to between Lines 662 and 682 (approx.).

 // these settings are SPECIFICALLY for the thermometer-blank.png image background
 
 $minX = 20; // left
 $maxX = 24; // right
 $minY = 20; // top
 $maxY = 140;// bottom
 

 $width = imagesx($image);
 $height = imagesy($image);
 $font = 1;

 $bg    = imagecolorallocate($image,153,255,255 );
 $tx    = imagecolorallocate($image,32,42,68);
 $blue  = imagecolorallocate($image,0,0,255);
 $red   = imagecolorallocate($image,255,0,0);
 if ($invertColor) {
   $tx    = imagecolorallocate($image,255,255,255);
   $blue  = imagecolorallocate($image,0,192,255);
   $red   = imagecolorallocate($image,255,32,32);
 }

On Line 674 (approx), I changed the thermometer image background color to my webpage background, but I still am viewing the image white background.  Could someone please direct me to a resolution?  Thank You in advance!

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Ajax Thermometer Image Color Fill Issue
« Reply #4 on: March 03, 2023, 10:55:47 AM »
You can use a transparent background for the thermometer.  Just change
Code: [Select]
$BlankGraphic  = './thermometer-blank2.png'; // relative file address for thermometer blank image PNG
to
Code: [Select]
$BlankGraphic  = './thermometer-blank-black.png'; // relative file address for thermometer blank image PNG
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline scudwatcher

  • Billy T. Forecaster Webmaster csraweather.net
  • Senior Contributor
  • ****
  • Posts: 157
  • Amateur Radio KC4SRA csraweather.net
    • CSRA Weather
Re: Ajax Thermometer Image Color Fill Issue
« Reply #5 on: March 03, 2023, 01:11:30 PM »
Thank You, Ken!