Stickers

Post Reply
spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Stickers

Post by spd2612 » Mon Oct 18, 2021 2:11 pm

I can not get stickers to display any info
Im on IIS 10
php 7.4
GD is enabled
Im using these links to test

https://hurricanepub.com/plugins/sticke ... 2=dark_red

https://hurricanepub.com/plugins/sticke ... age=random

https://hurricanepub.com/plugins/sticke ... ype=random

GD Test https://hurricanepub.com/plugins/stickers/gdtest.php

There are no errors in the error log

Also there is no save button in the configure for stickers is that normal ?
Last edited by spd2612 on Mon Oct 18, 2021 4:29 pm, edited 1 time in total.
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: Stickers

Post by spd2612 » Mon Oct 18, 2021 4:23 pm

Ok I created a simple PHP file and tested it from the stickers directory and it creates and prints

https://hurricanepub.com/plugins/stickers/test.php

this is the code I used

Code: Select all

<?php
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);

// Set the content type header - in this case image/jpeg
header('Content-Type: image/jpeg');

// Output the image
imagejpeg($im);

// Free up memory
imagedestroy($im);
?>
Meteotemplatelive.txt is on the server and updating, but still no print out on my stickers
Anyone have a Idea as to what is happening here ??
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

User avatar
Daali
Advisor
Advisor
Posts: 56
Joined: Mon Jul 26, 2021 8:06 pm
Location: Georgia, US
Station model: Ecowitt GW1002
Software: Meteobridge, FOSHKplugin
Contact:

Re: Stickers

Post by Daali » Tue Oct 19, 2021 6:38 pm

Sorry sir,

I still have not fixed my dev environment with v7.4.24 or v8. But I can tell you v7.4.24 works with your link on my site.
https://www.jeffersonweather.com/plugin ... age=random
https://www.jeffersonweather.com
GW1000 gateway
WS68 Anemometer
WH40 Rain Gauge
WH32 Temp/Hum
WH57 Lightning
WH41 PM2.5 Air Quality
WH45 PM2.5/10/Co2 Air Quality
WN34S Soil temperature
WH31SM Soil Moisture

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: Stickers

Post by spd2612 » Tue Oct 19, 2021 8:53 pm

I have my PHP on 7.4.13 and it does not work
There has to be a way to diagnose this I am getting no errors

Image
Last edited by spd2612 on Mon Nov 01, 2021 9:30 pm, edited 2 times in total.
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: Stickers

Post by spd2612 » Tue Oct 19, 2021 10:13 pm

I Finally forced a error out of this
How can I fix these errors

PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in E:\hurricanepub\plugins\stickers\stickerInteractiveAnim.php on line 1057

there are multiple lines with that issue

Spoke to soon none of them errors for stickersinteractive.php
they are just in stickerInteractiveAnim.php which i find strange
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

User avatar
Daali
Advisor
Advisor
Posts: 56
Joined: Mon Jul 26, 2021 8:06 pm
Location: Georgia, US
Station model: Ecowitt GW1002
Software: Meteobridge, FOSHKplugin
Contact:

Re: Stickers

Post by Daali » Wed Oct 20, 2021 11:36 am

Try phpstorm trial version for debugging. If your website is locally networked, you should be able to debug directly.
https://www.jeffersonweather.com
GW1000 gateway
WS68 Anemometer
WH40 Rain Gauge
WH32 Temp/Hum
WH57 Lightning
WH41 PM2.5 Air Quality
WH45 PM2.5/10/Co2 Air Quality
WN34S Soil temperature
WH31SM Soil Moisture

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Stickers

Post by davidefa » Wed Oct 20, 2021 3:02 pm

You can try this modified script, I only modified line 200 and 203 ( from "fonts" to "./fonts" )
Maybe you only have a font path problem ( I had the same problem with a few old scripts of mine )

P.S.
In the stickers plugin settings there is no save button
Attachments
stickerInteractive.zip
(4.8 KiB) Downloaded 53 times
Image

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: Stickers

Post by spd2612 » Thu Oct 21, 2021 12:08 pm

davidefa wrote: Wed Oct 20, 2021 3:02 pm You can try this modified script, I only modified line 200 and 203 ( from "fonts" to "./fonts" )
Maybe you only have a font path problem ( I had the same problem with a few old scripts of mine )

P.S.
In the stickers plugin settings there is no save button
That does not work either
when i refresh stickerinteractive with all logging on i get this error
stickerInteractive.php

[21-Oct-2021 08:15:46 America/New_York] PHP Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0

That is just a warning though
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Is any write permissions needed

Post by spd2612 » Fri Oct 29, 2021 8:52 pm

Still trying to find the stickers issue here
Is there any folder that needs write permissions
I have looked everywhere I know of to find a error here
The sticker wont even print the hello world
No other problems with my site
EXT that are enabed

[WebPIChanges]
error_log = "C:\Windows\temp\PHP74x64_errors.log"
upload_tmp_dir = C:\Windows\temp
session.save_path = C:\Windows\temp
cgi.force_redirect = 0
cgi.fix_pathinfo = 1
fastcgi.impersonate = 1
fastcgi.logging = 0
max_execution_time = 300
date.timezone = America/New_York
extension_dir = "C:\Program Files\PHP\v7.4\ext\"

[ExtensionList]
extension=php_mysqli.dll
extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_curl.dll
extension=php_exif.dll
extension=php_xmlrpc.dll
extension=php_openssl.dll
extension=php_soap.dll
extension=php_pdo_mysql.dll
extension=php_pdo_sqlite.dll
extension=php_imap.dll
extension=php_tidy.dll
[PHP_IMAGICK]
extension=php_imagick.dll
[PHP_WINCACHE]
extension=php_wincache.dll

This should not be this big of a issue
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Stickers

Post by davidefa » Fri Oct 29, 2021 9:17 pm

Can you provide a copy of your virtual machine ( in a format compatible with vmware player )?
Image

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: Stickers

Post by spd2612 » Fri Oct 29, 2021 10:04 pm

Do you mean of that whole server
My servers are all virtual running on esxi7.0
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Stickers

Post by davidefa » Sat Oct 30, 2021 9:56 am

spd2612 wrote: Fri Oct 29, 2021 10:04 pm Do you mean of that whole server
My servers are all virtual running on esxi7.0
Sorry, not familiar with 'that thing'.
I think you should pinpoint the problem with a simple script like the attached one ( it works on my server ).
It should create a 400x200 red image with a white "Hello world"
If the writing is not shown the only culprit should be the 'imagettftext' in line 12 and the only reason for this should be that php does not find the font ( so you need to modify the font definition in line 4, using a relative/absolute path, specifying a 'system' font... )
Clearly not sure about that.

P.S.
You could try in line 4:

Code: Select all

$font = realpath("./Roboto-Bold.ttf");        // font ( need to specify font with path )
or something like that

P.P.S.
Another thing to check ( don't remember if already checked ) is freetype support in php:


P.P.P.S.
As a last resort you could use the imagestring function ( you already found working correctly ):
use imageloadfont to load a bitmap font ( you need one font for each size used ) and write it with imagestring.
This is without antialiasing so the look could be a little 'pixelated'


hello.zip
(452 Bytes) Downloaded 49 times
Attachments
freetype.png
freetype.png (122.5 KiB) Viewed 4494 times
Image

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: Stickers

Post by spd2612 » Sat Oct 30, 2021 1:15 pm

well no text displayes on hello.php
I changed the relitive path on 4 no change
The URL to that font is https://hurricanepub.com/plugins/sticke ... o-Bold.ttf
it wil try to download it
GD looks good
What can I be missing

https://hurricanepub.com/plugins/stickers/hello.php
gd.jpg
gd.jpg (73.74 KiB) Viewed 4487 times
davidefa wrote: Sat Oct 30, 2021 9:56 am
spd2612 wrote: Fri Oct 29, 2021 10:04 pm Do you mean of that whole server
My servers are all virtual running on esxi7.0
Sorry, not familiar with 'that thing'.
I think you should pinpoint the problem with a simple script like the attached one ( it works on my server ).
It should create a 400x200 red image with a white "Hello world"
If the writing is not shown the only culprit should be the 'imagettftext' in line 12 and the only reason for this should be that php does not find the font ( so you need to modify the font definition in line 4, using a relative/absolute path, specifying a 'system' font... )
Clearly not sure about that.

P.S.
You could try in line 4:

Code: Select all

$font = realpath("./Roboto-Bold.ttf");        // font ( need to specify font with path )
or something like that

P.P.S.
Another thing to check ( don't remember if already checked ) is freetype support in php:


P.P.P.S.
As a last resort you could use the imagestring function ( you already found working correctly ):
use imageloadfont to load a bitmap font ( you need one font for each size used ) and write it with imagestring.
This is without antialiasing so the look could be a little 'pixelated'



hello.zip
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Stickers

Post by davidefa » Sat Oct 30, 2021 1:49 pm

We need an error showing what's going wrong.
Try adding this at the top of the script:

Code: Select all

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
Or try adding some error logging via php.ini/.htaccess ( see this or similar links )
Image

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: Stickers

Post by spd2612 » Sat Oct 30, 2021 2:47 pm

I have tried that
unable to get errors
with the below code in hello.php nothing displays
I can not get a error out of this
check the link and you will see how the code kills it

http://hurricanepub.com/plugins/stickers/hello.php

Code: Select all

<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$w = 400;
$h = 200;
$font = "../fonts/Roboto-Bold.ttf";        // font ( need to specify font with path )
$size = 24;							// text size

$img = imagecreatetruecolor($w, $h);
$bgColor = imagecolorallocate($img, 255, 0, 0);				// background color ( RGB format ) -> red
$fontColor = imagecolorallocate($img, 255, 255, 255);		// text color ( RGB format ) -> white
imagefilledrectangle($img, 0, 0, $w, $h, $bgColor);

imagettftext($img, $size, 0, 40, 80, $fontColor, $font, "Hello world");

header("Content-type: image/png");
imagepng($img);
imagedestroy($img);
?>
davidefa wrote: Sat Oct 30, 2021 1:49 pm We need an error showing what's going wrong.
Try adding this at the top of the script:

Code: Select all

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
Or try adding some error logging via php.ini/.htaccess ( see this or similar links )
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: Stickers

Post by spd2612 » Sat Oct 30, 2021 3:05 pm

I have error reporting turned on and if i open the hello.php in firefox i get a error message saying it can not be displayed because it contains errors
stickerinteractive.php will still open no print of course
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Stickers

Post by davidefa » Sat Oct 30, 2021 3:13 pm

Ok, comment the last 3 lines and you should be able to see the 'underlying error'

Code: Select all

//header("Content-type: image/png");
//imagepng($img);
//imagedestroy($img);
Image

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: Stickers

Post by spd2612 » Sat Oct 30, 2021 3:49 pm

Damn
getting somewhere here is error

Warning: imagettftext(): Could not find/open font in E:\hurricanepub\plugins\stickers\hello.php on line 15

This is line 15

imagettftext($img, $size, 0, 40, 80, $fontColor, $font, "Hello world");
Last edited by spd2612 on Sat Oct 30, 2021 3:53 pm, edited 1 time in total.
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Stickers

Post by davidefa » Sat Oct 30, 2021 4:02 pm

Try to set the absolute path to your font ( in line 8 ), this should be ok:

Code: Select all

$font = "E:/hurricanepub/plugins/stickers/Roboto-Bold.ttf";        // font ( need to specify font with path )
Not sure if you need to use backslash, in this case use:

Code: Select all

$font = "E:\\hurricanepub\\plugins\\stickers\\Roboto-Bold.ttf";        // font ( need to specify font with path )
Image

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Stickers

Post by davidefa » Sat Oct 30, 2021 4:06 pm

Ok, it seems working now
Image

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: Stickers

Post by spd2612 » Sat Oct 30, 2021 4:07 pm

I got it to remove the error by using
e:/hurricanepub/plugins/stickers/fonts/Roboto-Bold.ttf

then i uncomented the last three lines and Hellow world is there

Now what to do to fix stickers
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Stickers

Post by davidefa » Sat Oct 30, 2021 4:12 pm

If you want to use stickerInteractive.php change lines from 199 to 204 to:

Code: Select all

	if(isset($_GET['font'])){
		$fontFace = "e:/hurricanepub/plugins/stickers/fonts/".$_GET['font'].".ttf";
	}
	else{
		$fontFace = "e:/hurricanepub/plugins/stickers/fonts/Ubuntu-Regular.ttf";
	}
Image

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: Stickers

Post by spd2612 » Sat Oct 30, 2021 4:22 pm

looks great

I would imagine i would have to do the same to stickerInteractiveAnim.php
Tget that to work
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: Stickers

Post by spd2612 » Sat Oct 30, 2021 4:29 pm

Thanks a lot this has been driveing me nuts

I changed stickersinteractiveanim.php and it seems a little messed up

Image
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: Stickers

Post by spd2612 » Sat Oct 30, 2021 4:32 pm

This Works
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

Post Reply