cloudy

Author Topic: Weather Sticker PHP script v 3.0  (Read 104978 times)

0 Members and 1 Guest are viewing this topic.

Offline anole

  • Posts: 139
  • St. James City, FL USA
    • St. James City Weather
Weather Sticker PHP script v 3.0
« on: November 09, 2005, 08:29:28 PM »
Version 3.0 of my weather sticker script is now available:

http://scripts.anolecomputer.com/download.shtml

This version contains one important bug fix (I missed destroying one of the temporary images) and introduces support for Weather Display's clientraw.txt data file.

The biggest change is obviously the addition of support for clientraw.txt. If you upload Weather Display's clientraw.txt file to your site you can now use it's data instead of having to create and upload a separate template file. Because of the nature of the data contained in clientraw.txt, several additional parameters specific to it's use have been added.

In addition, since the clientraw.txt provides a value for a current conditions icon, I've added the capability to include a current conditions icon (25X25 px) to the sticker and banner. You can turn this off if you don't want to use it. I have included a set of 25X25px icons but I'm not a graphics guy so you aren't going to hurt my feelings if you want to use a different set. 

Please note that the icon functionality only works if you are using clientraw.txt at this point!

Other things in the works include:
  • Removing the need to have a default background image. The script would detect whether or not you have one and if you don't it will create one itself.
  • Creation and storage of an image file for situation where you can't call the script directly.

Even if you are not a WD clientraw.txt user you should still update to this version for the bug fix!

As usual, see the README.txt file for details on setup.
St. James City, FL Weather
http://weather.anolecomputer.com


Offline anole

  • Posts: 139
  • St. James City, FL USA
    • St. James City Weather
Re: Weather Sticker PHP script v 3.1
« Reply #1 on: November 11, 2005, 03:14:46 AM »
Version 3.1 is now available:

http://scripts.anolecomputer.com/download.shtml

Contains a minor bug fix. An error log entry was being generated if you weren't using the WD clientraw.txt current conditions icon.
St. James City, FL Weather
http://weather.anolecomputer.com


Offline FrankP999

  • Posts: 1,131
  • Macon, Georgia USA
    • My Weather
Re: Weather Sticker PHP script v 3.0
« Reply #2 on: November 14, 2005, 02:55:02 PM »
Could you give an example of the correct way to sprecify the data path to the clientraw? I put sticker.php, sticker.gif, and banner.gif in my main WD directory so clientraw is in the same place as the sticker files. I have $data_file_path  = '/frank.pinkston/frankpinkston_com/www/weather' but it is not seeing the clientraw file. How do I set $data_file_path?

Thanks for such great contribution!

Frank

Offline anole

  • Posts: 139
  • St. James City, FL USA
    • St. James City Weather
Re: Weather Sticker PHP script v 3.0
« Reply #3 on: November 14, 2005, 03:45:16 PM »
If it's in the same directory as sticker.php then you should be able to set it to:

$data_file_path  = './clientraw.txt'';
St. James City, FL Weather
http://weather.anolecomputer.com


Offline broadstairs

  • Stuart
  • Posts: 6,172
  • Broadstairs, Kent, UK
    • Broadstairs
Re: Weather Sticker PHP script v 3.0
« Reply #4 on: November 14, 2005, 04:20:09 PM »
I'm having trouble with this as well. I cannot get it to produce anything. I have clientraw.txt in the same directory as the sticker.php and have the path set to './clientraw.txt' and I'm running on my private Linux server using PHP5 and Apache btw, dont know if this may have a bearing on it?' Just keep getting the broen image icon instead of any meaningful output for both sticker and banner.

Stuart

Offline anole

  • Posts: 139
  • St. James City, FL USA
    • St. James City Weather
Re: Weather Sticker PHP script v 3.0
« Reply #5 on: November 14, 2005, 04:24:21 PM »
Is any error log being generated?
St. James City, FL Weather
http://weather.anolecomputer.com


Offline FrankP999

  • Posts: 1,131
  • Macon, Georgia USA
    • My Weather
Re: Weather Sticker PHP script v 3.0
« Reply #6 on: November 14, 2005, 04:36:09 PM »
If it's in the same directory as sticker.php then you should be able to set it to:
$data_file_path  = './clientraw.txt'';

Thanks! That worked for me! Now that I have the basics ...I plan on some customizations like fonts, etc

Thanks again

Frank

Offline broadstairs

  • Stuart
  • Posts: 6,172
  • Broadstairs, Kent, UK
    • Broadstairs
Re: Weather Sticker PHP script v 3.0
« Reply #7 on: November 14, 2005, 04:38:00 PM »
Is any error log being generated?


Yes quite a few, mainly about type in $_Request[type] on line 381 amongst others. most of the others are warnings wher it assumes something and so wont stop it.

Stuart

Offline anole

  • Posts: 139
  • St. James City, FL USA
    • St. James City Weather
Re: Weather Sticker PHP script v 3.0
« Reply #8 on: November 14, 2005, 04:40:34 PM »
Can you post the exact log entries for me?
St. James City, FL Weather
http://weather.anolecomputer.com


Offline anole

  • Posts: 139
  • St. James City, FL USA
    • St. James City Weather
Re: Weather Sticker PHP script v 3.0
« Reply #9 on: November 14, 2005, 04:42:29 PM »
... and a the URL you are using to call the script.
St. James City, FL Weather
http://weather.anolecomputer.com


Offline broadstairs

  • Stuart
  • Posts: 6,172
  • Broadstairs, Kent, UK
    • Broadstairs
Re: Weather Sticker PHP script v 3.0
« Reply #10 on: November 14, 2005, 04:45:20 PM »
... and a the URL you are using to call the script.

The logs are

[client 192.168.0.7] PHP Notice:  Use of undefined constant float - assumed 'float' in /var/www/html/wxsticker/sticker.php on line 281, referer: http://192.168.0.7/sticker.html
[client 192.168.0.7] PHP Notice:  Use of undefined constant type - assumed 'type' in /var/www/html/wxsticker/sticker.php on line 381, referer: http://192.168.0.7/sticker.html
[client 192.168.0.7] PHP Notice:  Use of undefined constant type - assumed 'type' in /var/www/html/wxsticker/sticker.php on line 391, referer: http://192.168.0.7/sticker.html
[client 192.168.0.7] PHP Notice:  Use of undefined constant float - assumed 'float' in /var/www/html/wxsticker/sticker.php on line 281, referer: http://192.168.0.7/sticker.html
[client 192.168.0.7] PHP Notice:  Use of undefined constant type - assumed 'type' in /var/www/html/wxsticker/sticker.php on line 381, referer: http://192.168.0.7/sticker.html
[client 192.168.0.7] PHP Notice:  Undefined index:  type in /var/www/html/wxsticker/sticker.php on line 381, referer: http://192.168.0.7/sticker.html
[client 192.168.0.7] PHP Notice:  Use of undefined constant type - assumed 'type' in /var/www/html/wxsticker/sticker.php on line 384, referer: http://192.168.0.7/sticker.html
[client 192.168.0.7] PHP Notice:  Use of undefined constant type - assumed 'type' in /var/www/html/wxsticker/sticker.php on line 391, referer: http://192.168.0.7/sticker.html
[client 192.168.0.7] PHP Notice:  Undefined index:  type in /var/www/html/wxsticker/sticker.php on line 391, referer: http://192.168.0.7/sticker.html
[client 192.168.0.7] PHP Notice:  Use of undefined constant type - assumed 'type' in /var/www/html/wxsticker/sticker.php on line 394, referer: http://192.168.0.7/sticker.html
[client 192.168.0.7] PHP Notice:  Use of undefined constant type - assumed 'type' in /var/www/html/wxsticker/sticker.php on line 412, referer: http://192.168.0.7/sticker.html
[client 192.168.0.7] PHP Notice:  Use of undefined constant type - assumed 'type' in /var/www/html/wxsticker/sticker.php on line 412, referer: http://192.168.0.7/sticker.html
[client 192.168.0.7] PHP Notice:  Undefined index:  type in /var/www/html/wxsticker/sticker.php on line 412, referer: http://192.168.0.7/sticker.html

Cant post a URL as it is a private server on my lan....

Stuart

Offline anole

  • Posts: 139
  • St. James City, FL USA
    • St. James City Weather
Re: Weather Sticker PHP script v 3.0
« Reply #11 on: November 14, 2005, 05:27:05 PM »
It almost looks like your install or setup isn't allowing the superglobal $_REQUEST to be populated.

Create a php page with markup and php and go to it in your browser giving it some garbage variables like http://test.php?var1=x1&var2=x2. What do you get?

<html>
<head>
</head>
<body>
<?php
print("Request method: " . $_SERVER['REQUEST_METHOD']."<br />");
print("Dump of HTTP RAW POST DATA ". var_dump($HTTP_RAW_POST_DATA)."<br
/>");
print("Dump of POST Data" . var_dump($_POST)."<br />");
print("Dump of REQUEST Data" . var_dump($_REQUEST)."<br />");
?>
</body>   

What you should see is something like this:
http://weather.anolecomputer.com/test.php?var1=x1&var2=x2

St. James City, FL Weather
http://weather.anolecomputer.com


Offline broadstairs

  • Stuart
  • Posts: 6,172
  • Broadstairs, Kent, UK
    • Broadstairs
Re: Weather Sticker PHP script v 3.0
« Reply #12 on: November 14, 2005, 05:48:46 PM »
Your suggested script gives output of:

Request method: GET

Notice: Undefined variable: HTTP_RAW_POST_DATA in /var/www/html/test.php on line 7
NULL Dump of HTTP RAW POST DATA
array(0) { } Dump of POST Data
array(2) { ["var1"]=> string(2) "x1" ["var2"]=> string(2) "x2" } Dump of REQUEST Data

Stuart

Offline anole

  • Posts: 139
  • St. James City, FL USA
    • St. James City Weather
Re: Weather Sticker PHP script v 3.0
« Reply #13 on: November 14, 2005, 06:00:14 PM »
Stuart,
I just sent you an IM.
St. James City, FL Weather
http://weather.anolecomputer.com


Offline Stuntman

  • Posts: 731
  • Hemet, California USA
    • Hemet Weather
Re: Weather Sticker PHP script v 3.0
« Reply #14 on: November 14, 2005, 06:23:14 PM »
I am trying to run this using Apache 2.0, PHP5 and Windows XP Pro..

I get the following error when I run it..
Fatal error: Call to undefined function imagecreatefromgif() in C:\Program Files\Apache Group\Apache2\htdocs\weather\sticker.php on line 343


You can see this yourself at http://wx.hemetweather.com/weather/sticker.php


I believe it has something to do with the imagecreatfromgif function being removed from current versions of PHP, or something of that nature.. can anybody supply a work around for this?

Thanks!

 

cumulus