WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Topic started by: jmcmurry on March 31, 2022, 02:52:11 PM

Title: wxStory 3.0
Post by: jmcmurry on March 31, 2022, 02:52:11 PM
Attached is wxStory 3.0 that adds the Eastern Stations, and re-classifies some of the others.  Also added are several options for map and dropdown list placement.

The attached .zip file is Curly's last version with the updated files included.  This will be replaced in this post with any future updates.

Jerry Wilkins was invaluable and spent a lot of time testing and helping to get this in its final form.  He identified many issues and reminded me that it should be validated before it was complete. 

Enjoy!

Title: Re: wxStory 3.0
Post by: rrrick8 on March 31, 2022, 08:49:58 PM
Got it downloaded, then uploaded and working great Jim. Thanks a bunch.
Mine was working fine but this is far more efficient.

Rick
Title: Re: wxStory 3.0
Post by: jmcmurry on April 01, 2022, 04:40:52 AM
Thanks Rick, it's good to hear that everything went smoothly.  - Jim
Title: Re: wxStory 3.0
Post by: tmabell on April 01, 2022, 08:12:37 AM
Many thanks to you Jim and also Jerry!  This script has been needing attention for a long time.  Nice work  =D>

EDIT: I've confirmed that it validates HTML5.
Title: Re: wxStory 3.0
Post by: SteveFitz1 on April 01, 2022, 10:25:03 AM
Great work Jim and Jerry. This works great.

I had one issue/suggestion for you. I noticed that on almost all the WFOs I visited that the weather story image appeared distorted, that is, the image height wasn't proportional to the width (I used the 700 default). Looking into the code, I noticed you chose to use the height as 58% of the width. Realizing there appears not to be a standard among the WFOs, I changed that value to .75 because it made the images I was viewing much less distorted.

My suggestion is to move the $imgheight variable under Main Settings and add a note in the readme telling the users they may want to play with this value to get the best looking images for the WFOs they use.

Thanks again for updating this script.

Steve
Title: Re: wxStory 3.0
Post by: jmcmurry on April 01, 2022, 10:41:50 AM
Steve,

I'll make that change, but at my WFO that distorts the images terribly the other way.  I may have a better idea if I can get it to work.

Thanks for the input.  - Jim
Title: Re: wxStory 3.0
Post by: jmcmurry on April 01, 2022, 06:34:30 PM
Well, that worked and has been tested by both Steve and Jerry.  Attached here and updated in the .zip.  - Jim
Title: Re: wxStory 3.0
Post by: W3DRM on April 03, 2022, 02:06:26 PM
Nice job guys! I've always wanted to know the east coast stories as have I family up and down the eastern seaboard and they have asked if anything like this was available. Now I can tell them YES.

It works great - WELL DONE!  [tup]

I just wish Boise, Idaho had weather story info too.
Title: Re: wxStory 3.0
Post by: ALITTLEweird1 on April 03, 2022, 07:48:47 PM
Getting an error on my parent's page....

Warning: Division by zero in /homepages/14/d347616009/htdocs/wxStory_inc.php on line 570


if(preg_match("|$imName\"|",$hv)) {                                                //  IF the selected image is in the headline
      $hv = preg_replace('/-color:#F0F7FF/', '-color:#0071BC', $hv);                   //   change background color to blue
      $hv = preg_replace('/ color: #0071BC/', ' color:#FFF', $hv);                     //   change text color to white
      $hv = preg_replace('/td style="/', 'td style="width:'.$hdlnrwidth.'px; ', $hv);  //   adjust column width
   } else{                                                                               //  OR ELSE                                        <<<<<< LINE 570
      $hv = preg_replace('/ background-color:#F0F7FF;/', '', $hv);                     //   change background color to a light color
      $hv = preg_replace('/td style="/', 'td style="width:'.$hdlnrwidth.'px; ', $hv);  //   change column width
      $hv = preg_replace('/td style="/', 'td class="hdline" style="border-bottom: thin solid #0071BC; border-top: thin solid #0071BC; ', $hv);  //   change column width
   }
   $hdline .= $hv."\n";


Everything works fine on my page. Thanks

UPDATE: Turns out MS Edge is blocking the images from being loaded. Has anyone else seen that issue before?

Title: Re: wxStory 3.0
Post by: jmcmurry on April 04, 2022, 04:39:21 AM
Mark,

Are they still getting that error?  Was there a setting in Edge that needed changing?

- Jim
Title: Re: wxStory 3.0
Post by: tmabell on April 04, 2022, 05:45:14 AM
EDIT: IWX has updated the image and the problem has dissapeared.  I wish I had saved a copy of the offending image for troubleshooting but I didn't think of it soon enough.

ORRIGINAL POST:
I'm getting a PHP fatal error this morning on line 570 of wxStory_inc.php.  This seems to be just on KIWX (Northern Indiana's) page but I have only checked a few.

570 $R = $height/$width; 

PHP Fatal error:  Uncaught DivisionByZeroError: Division by zero in C:\\www\\wxStory_inc.php:570\nStack trace:\n#0 C:\\www\\MidWestWXstory.php(226): include()\n#1 {main}\n  thrown in C:\\www\\wxStory_inc.php on line 570

I haven't had an issue with Edge unless this is related.
Title: Re: wxStory 3.0
Post by: ALITTLEweird1 on April 04, 2022, 09:15:59 AM
Hey Jim. It seems to have fixed itself. I'll keep an eye on it.
Title: Re: wxStory 3.0
Post by: jmcmurry on April 04, 2022, 01:19:15 PM
I just wish Boise, Idaho had weather story info too.
All you had to do is ask for it.  They have a Story today!!

Mark, good news!
Title: Re: wxStory 3.0
Post by: tmabell on April 04, 2022, 03:49:19 PM
The error on line 70, when it occurs causes the script to break.  Could this happen if the image happened to be missing at the moment we attempt to access it?  If so, can that possibility be accounted for?   I'm thinking of that brief time when the images being replaced or updated.
Title: Re: wxStory 3.0
Post by: jmcmurry on April 04, 2022, 04:34:49 PM
That happens when we get an incomplete image from the NWS.  I haven't seen that recently, but it used to happen a lot.  I'll see if there's a good way around that.  Are you set to use the cURL or the streaming function?

Thanks.  - Jim
Title: Re: wxStory 3.0
Post by: tmabell on April 04, 2022, 05:04:46 PM
Yes, I made the change back to curl with your initial release of ver 3.0.
Title: Re: wxStory 3.0
Post by: jmcmurry on April 05, 2022, 10:24:34 AM
I've attached Version 3.02 which

1) Fixed calculating the image display height for divide by 0.
2) Added the option for maintaining screen scroll position.
3) Added the option to show/hide the captions below the Weather Story image.

Please let me know if you have any problems or comments.  - Jim
Title: Re: wxStory 3.0
Post by: tmabell on April 05, 2022, 10:56:58 AM
I hate to report that there is still aa problem.  If you try BOI (Boise, ID) you'll get a script-breaking error again related to divide by zero.  I don't think they have a Weather Story today but trying theirs anyway exposed this bug.
Title: Re: wxStory 3.0
Post by: jmcmurry on April 05, 2022, 12:15:02 PM
If you see it again, get a line number if you can.  Thanks, - Jim
Title: Re: wxStory 3.0
Post by: tmabell on April 05, 2022, 01:57:24 PM
This happens every time I click on Boise, ID.  I noticed that it happens on your site also, Jim.  My Apache logs print this:

Quote
[Tue Apr 05 13:54:05.127905 2022] [php:warn] [pid 11708:tid 800] [client 192.168.10.1:52687] PHP Warning:  getimagesize(./wscache/wsimg_boi.png): Failed to open stream: No such file or directory in C:\\www\\wxStory_inc.php on line 583, referer: https://mymishawakaweather.com/MidwestWXStory.php
[Tue Apr 05 13:54:05.127905 2022] [php:error] [pid 11708:tid 800] [client 192.168.10.1:52687] PHP Fatal error:  Uncaught DivisionByZeroError: Division by zero in C:\\www\\wxStory_inc.php:587\nStack trace:\n#0 C:\\www\\MidWestWXstory.php(226): include()\n#1 {main}\n  thrown in C:\\www\\wxStory_inc.php on line 587, referer: https://mymishawakaweather.com/MidwestWXStory.php

For reference, the image is not in ./wscache.  I assume this occurs because BOI does not have an image presently.  Hope this helps.


Title: Re: wxStory 3.0
Post by: jmcmurry on April 05, 2022, 05:33:32 PM
Thanks, that's a huge help.  I see that now on my site too.  I've clicked on them many times before, so I'll bet it has something to do with them being "open for business" yesterday.

The attached should take care of it.  That's a very complicated part of Curly's code, so I don't know why that would happen only for Boise.

 - Jim
Title: Re: wxStory 3.0
Post by: tmabell on April 05, 2022, 05:58:09 PM
Thanks Jim!  That seems to have solved it.  There is some errata in the logs but the script functions without fail.  I don't know if these matter but I'll pass them on just in case.

Quote
[Tue Apr 05 17:53:32.778895 2022] [php:warn] [pid 11708:tid 768] [client 192.168.10.1:51647] PHP Warning:  imagecreatefrompng(): gd-png: libpng warning: Interlace handling should be turned on when using png_read_image in C:\\www\\wxStory_inc.php on line 678, referer: https://mymishawakaweather.com/
[Tue Apr 05 17:53:50.870929 2022] [php:warn] [pid 11708:tid 808] [client 192.168.10.1:51670] PHP Warning:  Undefined variable $imgheight in C:\\www\\wxStory_inc.php on line 734, referer: https://mymishawakaweather.com/MidwestWXStory.php
[Tue Apr 05 17:53:58.436362 2022] [php:warn] [pid 11708:tid 768] [client 192.168.10.1:51671] PHP Warning:  Undefined variable $imgheight in C:\\www\\wxStory_inc.php on line 734, referer: https://mymishawakaweather.com/MidwestWXStory.php?i=pih
Title: Re: wxStory 3.0
Post by: jmcmurry on April 06, 2022, 07:10:11 AM
We found that the first warning was due to a file version on the server, and the attached should take care of the other.  I left the version # the same because it's a minor mod to a previous fix.

- Jim
Title: Re: wxStory 3.0
Post by: drrehak on April 12, 2022, 12:53:00 PM
Installed this for the first time today and it seems to be working.
While testing, I tried Portland, and got the "no story today" header, but it still tried to display the nonexistent image from the cache directory, so I got the broken image icon and a large blank area on the page.

Don't know if there is a better solution or if I did something wrong, but I made the following change -- just added the conditional test to control the display of the table row with the image:
Code: [Select]
<?php if (file_exists($wsimg)) {?>
 <tr>
 <td style="text-align:center"><img src="<?php echo $wsimg ?>" style="width: <?php echo $tablewdth;  ?>px; height: <?php echo $imgheight ?>px;" alt=" " /></td>
 </tr>
 <tr>
<?php }; ?>
Title: Re: wxStory 3.0
Post by: jmcmurry on April 13, 2022, 05:52:45 AM
Thanks Dan, I hadn't seen that problem.  That is a prudent change and I will add it.



[Edit] The updated script is attached.  Thanks again.  - Jim
Title: Re: wxStory 3.0
Post by: drrehak on April 13, 2022, 07:47:47 AM
Thanks Jim.  Glad to help.
Title: Re: wxStory 3.0
Post by: Jumpin Joe on April 13, 2022, 10:00:12 AM
Just installed this and I am getting a bunch of errors. Can you tell me what I have done wrong?



Warning: fopen(./wscache/wsimg_iln_weatherstory.png): failed to open stream: No such file or directory in /home/joes/www/www/wxStory_inc.php on line 256

Warning: fwrite() expects parameter 1 to be resource, bool given in /home/joes/www/www/wxStory_inc.php on line 257

Warning: fclose() expects parameter 1 to be resource, bool given in /home/joes/www/www/wxStory_inc.php on line 258

Warning: Division by zero in /home/joes/www/www/wxStory_inc.php on line 680

Warning: imagecreatetruecolor() expects parameter 2 to be int, float given in /home/joes/www/www/wxStory_inc.php on line 681

Warning: imagecopyresampled() expects parameter 1 to be resource, null given in /home/joes/www/www/wxStory_inc.php on line 682

Warning: imagedestroy() expects parameter 1 to be resource, null given in /home/joes/www/www/wxStory_inc.php on line 694

Warning: fopen(./wscache/wsdata_iln.php): failed to open stream: No such file or directory in /home/joes/www/www/wxStory_inc.php on line 479
WEATHER STORY
Wilmington
Weather Forecast Office

Warning: include(wxStory_drop_inc.php): failed to open stream: No such file or directory in /home/joes/www/www/wxStory_inc.php on line 718

Warning: include(): Failed opening 'wxStory_drop_inc.php' for inclusion (include_path='.:/usr/local/php73/lib/php') in /home/joes/www/www/wxStory_inc.php on line 718
Weather Story
Data Courtesy of Wilmington Weather Forecast Office[/color]



Thanks,
Joe
www.joesweather.info
Title: Re: wxStory 3.0
Post by: drrehak on April 13, 2022, 10:32:43 AM
First thing to check is that you created the wscache directory and the path matches that in the script.  From your output it looks like it should be
/home/joes/www/www/wscache
Second, make sure there is write permission to that directory so the script can create the files.
Title: Re: wxStory 3.0
Post by: drrehak on April 13, 2022, 10:39:02 AM
Also, looks like you didn't install wxStory_drop_inc.php
You need to get the entire zip file from earlier in the thread, not just the latest .txt file.  There are more instructions in the .zip
Title: Re: wxStory 3.0
Post by: Jumpin Joe on April 13, 2022, 11:22:01 AM
Thank you, Dan.

You are correct, the only script I downloaded and installed is wxStory.php

Ill complete the installation a little later on today.

Joe
Title: Re: wxStory 3.0
Post by: Jumpin Joe on April 13, 2022, 01:12:00 PM
Completed the installation of ALL the folders and files.

Life is good.

Thanks again, Jim and Dan!
Joe
Title: Re: wxStory 3.0
Post by: jmcmurry on April 15, 2022, 02:40:50 PM
Attached is version 3.05 which adds a configuration item for validation.  <script type="text/javascript"> is not allowed in HTML5. 

It also cleans  up the WFO array which was missing some spaces in the WFO names.

- Jim.
Title: Re: wxStory 3.0
Post by: drrehak on April 18, 2022, 12:45:02 PM
Hi Jim

Been playing with the script some more.  I noticed a couple times that I would get
the show/hide caption button, but no text.

Today Caribou Maine is showing a story image and caption on there site, but $wsdata ends up as a zero length string in the script.  Not been able to figure out when the script isn't able to find the caption (finding the cases when it doesn't work has been trial and error).  Haven't tried to dig into all the page parsing code.
    - Dan
Title: Re: wxStory 3.0
Post by: jmcmurry on April 19, 2022, 04:46:35 AM
Dan,

There are some of the eastern sites that never have any notes.  Then there apparently are some that are sporadic.  I should be able to insert a "not available" note when they don't have one.  Busy today but should be able to work on it tomorrow.  Thanks for finding these things.

- Jim
Title: Re: wxStory 3.0
Post by: drrehak on April 19, 2022, 09:27:49 AM
Hi Jim,

Thanks.  No rush at at -- whenever you get to it.

In this case, the problem isn't their site, its the script.
Here a screen grab of what Caribou is showing today -- includes the note.
(http://[attachment id=1 msg=445901][/attachment])

And here's their HTML:
Code: [Select]
<body><pre style="word-wrap: break-word; white-space: pre-wrap;">Gusts to 65 mph from east/southeast near the coast today. Heavy rain Downeast from ~7am-2pm. Locally 3” rain could fall in just a few hours. Minor coastal flooding around the early afternoon high tide.
Northern Maine, snow and sleet totals generally &lt;1”, except higher amounts over higher elevations. Changing to rain by early afternoon.
</pre></body>

And here's what the script generates:
Code: [Select]
<?php

$mainStory 
= array (
  &
#39;WeatherStory&#39; => 
  
array (
    
=> &#39;&#39;,
    
=> &#39;&#39;,
    
=> &#39;https://www.weather.gov/images/car/WeatherStory.gif&#39;,
    
=> &#39;https://www.weather.gov/car/&#39;,
    
=> &#39;./wscache/wsimg_car_WeatherStory.gif&#39;,
    
=> &#39;gif&#39;,
    
=> &#39;WeatherStory&#39;,
    
=> &#39;car&#39;,
    
=> &#39;Caribou&#39;,
  
),
);

$altStory = array (
);

$nfo = &#39;Caribou&#39;;

$hdlnr = array (
  
=> &#39;     <td style="text-align: center; background-color:#F0F7FF; padding: 6px 0px 6px;"><a href="/weather/st/wxstory.php?i=car&amp;ifn=WeatherStory" title="" style="text-decoration: none; color: #0071BC; font-size: 1.3em;">Weather Story</a></td>&#39;,
);


?>


From what I can tell, array[1] shouldn't be empty.  Something wrong it parsing.
I do see that this site is wrapping the caption in a <pre> unlike other sites.
And they have the "" in the output.  I've not be able to figure out all the
script code to tell if this is the problem.

If $wsdata is legitimately empty, adding a strlen around the row will turn it and the button off, but that's not what should happen here.
Code: [Select]
<?php if(strlen($wsdata)>0){ ?>
 <tr>

<?php if ($UseShowHide) { ?>
 <td> <!-- align was center -->
 <div id="myDIV" style = "width: <?php echo $tablewdth?>px;text-align: left;background-color: white;margin-top: 5px; display: <?php echo $CDisplay?>;">
<?php echo $wsdata?>
</div>
 <button id="myButton" style="float: left;background-color: #0071BC; margin-top: 5px; padding: .3em; -moz-border-radius: 5px;-webkit-border-radius: 5px;border-radius: 6px;color: white;font-size: 12px; font-weight:600; text-decoration: none; border: none; " onclick="myFunction()"> <?php echo $CCaption;?>  </button>
 </td>
<?php } else { ?>
  <td style="text-align:justify; line-height: 160%;"><?php echo $wsdata?></td>
<?php ?> 
 </tr>
<?php ?>

    - Dan
Title: Re: wxStory 3.0
Post by: zeppline on April 19, 2022, 08:40:21 PM
I downloaded wxstory and it working except I can not get the map to load. it is in images/WS_map but the program can't find it. If I use the web "lasvegaswx.com/images/WS_map" it is there? What am I missing.  Thanks Joe
Title: Re: wxStory 3.0
Post by: jmcmurry on April 19, 2022, 09:29:06 PM
Joe, the map file must be named WS_map.png.  Give that a try.  - Jim
Title: Re: wxStory 3.0
Post by: zeppline on April 19, 2022, 10:02:40 PM
Thanks Jim after 3 days I new it was something small. I thought the program added the png. I know enough to get in trouble. Thanks again Joe
Title: Re: wxStory 3.0
Post by: jmcmurry on April 20, 2022, 07:34:06 AM
I'm glad you got it working Joe.

Attached is Ver 3.06 that takes care of the eastern stations that had no captions/notes.    Thanks for catching this too Dan.
Title: Re: wxStory 3.0
Post by: Silversword on April 21, 2022, 02:30:17 PM
Hi All,

Thanks Jim for updates.  It  is too bad that Hawaii and Alaska are not included with this scripts yet.

Aloha,

--Stan Y.
   Maui, Hawaii
Title: Re: wxStory 3.0
Post by: jmcmurry on June 15, 2022, 07:31:45 PM
I've updated the .zip in the first post to V3.07.  The map and script were updated after tracking WFO performance for over 3 months.  Basically, Reno turned yellow.  - Jim

Stan, I'd love to add those sites if they ever participate.
Title: Re: wxStory 3.0
Post by: Silversword on June 16, 2022, 12:57:27 AM
Thanks Jim for the update and hope one of these days the NWS office here will participate as well as Alaska.

Aloha,

--Stan Y.
   Maui. Hawaii
Title: Re: wxStory 3.0
Post by: hunter362 on June 28, 2022, 10:52:22 PM
Joe, the map file must be named WS_map.png.  Give that a try.  - Jim
Jim, I've got a similar issue with the map being drawn, here's the error I'm getting:  [ You are not allowed to view attachments ]

Unable to open  './images/Ws_map_bgm.png' for writing: Permissiom denied in wxStory_inc.php line 158

permissions are 644 on the images

Viewing source I get a 404 error
!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /images/WS_map_bgm.png was not found on this server.</p>
</body></html>

What am I missing here?
Title: Re: wxStory 3.0
Post by: jmcmurry on June 29, 2022, 05:52:45 AM
Bill,

I'm running the script on two different servers and the images are 0644 on both.  The images folder itself is set 0755, maybe you can check that?

Please post the url of the file that is including wxStory_inc.php, or upload weather-story-test.php So I can test from here.

- Jim
Title: Re: wxStory 3.0
Post by: hunter362 on June 29, 2022, 09:21:26 AM
Jim,
Images folder is 0755, changed folders, changed all images to 0777, still get the same error

PHP 5.5.9-1ubuntu4.29+esm15 (cli) (built: Oct 27 2021 18:41:06)

http://www.camillusweather.com/weather-story.php
Title: Re: wxStory 3.0
Post by: 92merc on June 29, 2022, 11:51:04 AM
I'm not sure how the script works to pull my images, but they aren't showing.  I'm getting the headers correct, just not showing the pictures.

https://www.weather.gov/bis/weatherstory
https://www.bismarckweather.net/wxstory.php
Title: Re: wxStory 3.0
Post by: jmcmurry on June 30, 2022, 06:51:45 AM
Right now, I'm clueless as to why these two different problems are happening.  I suggest that we start by making sure we're all on the most recent version of the wxStory_inc.php script.  Version 3.07 is in the first post in this thread.

- Jim
Title: Re: wxStory 3.0
Post by: 92merc on June 30, 2022, 08:44:29 AM
I just re-downloaded and configured mine again.  Pictures are still MIA.
Title: Re: wxStory 3.0
Post by: jmcmurry on June 30, 2022, 09:21:27 AM
92merc, please try using a ftp program such as Filezilla and clear everything out of your wscache folder and see if that helps.

hunter362, any chance of creating a new images folder with just WS_map.png in it?

- Jim
Title: Re: wxStory 3.0
Post by: 92merc on June 30, 2022, 09:34:51 AM
527 files cleared from cache.  Issue persists.
wsdata_bis.php, wsdata_grr.php showed up after I tested the page.  Plus a couple of matching wsimg files.
Title: Re: wxStory 3.0
Post by: Maumelle Weather on June 30, 2022, 11:31:51 AM
527 files cleared from cache.  Issue persists.
wsdata_bis.php, wsdata_grr.php showed up after I tested the page.  Plus a couple of matching wsimg files.

Hi 92merc,

I can see the images for Bismarck at this time on your webpage. You may want to try clearing your browser cache and see if that resolves the issue.

Hope this helps,

John
Title: Re: wxStory 3.0
Post by: 92merc on June 30, 2022, 12:03:38 PM
Looks to be a Firefox issue.  New FF 102 doesn't like it.  Chrome and Edge are fine.
Title: Re: wxStory 3.0
Post by: jmcmurry on June 30, 2022, 12:44:34 PM
Same here, bad in FF but OK in Chrome.  Maybe there's a FF expert out there that can point us to something in about:config that may have changed.

But why is it picking on Bismarck?
Title: Re: wxStory 3.0
Post by: jmcmurry on June 30, 2022, 07:06:07 PM
hunter362, lets try this:

In your script settings change to $ws_mapfolder   = './images2/ then create that folder on the server and put WS_map.png in it.  That way we've got everything "fresh".  We can write our story images to wscache so there should be no reason that we can't write to this folder.

- Jim
Title: Re: wxStory 3.0
Post by: Jasiu on June 30, 2022, 08:46:35 PM
Looks to be a Firefox issue.  New FF 102 doesn't like it.  Chrome and Edge are fine.

Yup, I just updated FF on my MacBook and now I see the problem.

Below are what I get if I inspect the image in Safari and then in Firefox.

 [ You are not allowed to view attachments ]  [ You are not allowed to view attachments ]

So for some reason firefox thinks it can't load it. I'll see if I can figure out anything.
Title: Re: wxStory 3.0
Post by: Jasiu on June 30, 2022, 08:56:22 PM
This may have something to do with it...

The file on the NWS site is:

  Tab2FileL.png?020f87cf059e08a23be281de8ae0790c

Somehow that gets transformed into wsimg_bis_Tab2FileL.png-6ce9d44e0ebc8de245e961dc1b8.e3b as the file name loaded into the cache. Firefox is probably barfing at the ".e3b" suffix.  If I try to load

  https://www.bismarckweather.net/wscache/wsimg_bis_Tab2FileL.png-6ce9d44e0ebc8de245e961dc1b8.e3b

I get this error:

Quote
Content Encoding Error

An error occurred during a connection to www.bismarckweather.net.

    Please contact the website owners to inform them of this problem.

I don't use this script but I'll download it to see why/how the parameter after the "?" in the URL is handled.

Title: Re: wxStory 3.0
Post by: jmcmurry on June 30, 2022, 09:44:37 PM
It's a cache somewhere that needed to expire.  Bismarck now works fine for me on both my servers with FF.   ](*,)

Title: Re: wxStory 3.0
Post by: hunter362 on June 30, 2022, 11:19:47 PM
hunter362, lets try this:

In your script settings change to $ws_mapfolder   = './images2/ then create that folder on the server and put WS_map.png in it.  That way we've got everything "fresh".  We can write our story images to wscache so there should be no reason that we can't write to this folder.

- Jim
God Bless America!  That worked, changed owner and group to www-data permissions to 0755 and it WORKS fine now! Thank you Jim
and BTW, excellent job on this script!
Title: Re: wxStory 3.0
Post by: jmcmurry on July 01, 2022, 06:08:01 AM
Outstanding!!
Title: Re: wxStory 3.0
Post by: 92merc on July 01, 2022, 09:19:09 AM
I tried making the images2 folder and change my script.  No change for me.
Title: Re: wxStory 3.0
Post by: Jasiu on July 01, 2022, 09:50:05 AM
I tried making the images2 folder and change my script.  No change for me.

I still don't see the first image on your page either, despite the fact that the image (and file name) have both changed.

Title: Re: wxStory 3.0
Post by: jmcmurry on July 01, 2022, 01:26:47 PM
92merc, the /images2/ fix was for hunter362's map problem. 

Your FF problem is a mystery even though it straightened out for my FF.

- Jim
Title: Re: wxStory 3.0
Post by: Jasiu on July 01, 2022, 02:55:56 PM
I sent 92merc the following change to test and it seems to work now.

Code: [Select]
//  $html = preg_replace("/\.png\?(.+?)/" , ".png " , $html);               // cut off random numbering of png
//  $html = preg_replace("/\.jpg\?(.+?)/" , ".jpg " , $html);               // cut off random numbering of jpg
//  $html = preg_replace("/\.gif\?(.+?)/" , ".gif " , $html);               // cut off random numbering of jpg
  $html = preg_replace("/\.png\?[^\"]+/" , ".png" , $html);               // cut off random numbering of png
  $html = preg_replace("/\.jpg\?[^\"]+/" , ".jpg" , $html);               // cut off random numbering of jpg
  $html = preg_replace("/\.gif\?[^\"]+/" , ".gif" , $html);               // cut off random numbering of jpg

The previous code was just replacing the "?" character in the URL with a space, which then led to the weird file name for the cache. The idea with the changed code is to remove the "?" and everything beyond until a quote mark is reached.
Title: Re: wxStory 3.0
Post by: jmcmurry on July 03, 2022, 01:26:45 PM
I've updated the script and Version 3.08 is now available in the first post in this thread.

A big thanks to 92merc for identifying the problem and to Jaisu for investigating and providing the fix.

- Jim
Title: Re: wxStory 3.0
Post by: jmcmurry on August 05, 2022, 06:56:18 AM
I've once more updated the script and Version 3.09 is now available in the first post in this thread.

It fixes some problems with resizing the Weather Story images.

- Jim
Title: Re: wxStory 3.0
Post by: SteveFitz1 on August 18, 2022, 11:31:30 AM
Jim,

I'm noticing an issue you fixed back in April has returned...at least for me. This had to do with the image being mashed down a bit and quite distorted. I was seeing this recently again on 3.07 so I installed 3.09 and it still occurs.

It happens for me on SHV. I checked other sites and most were correct. However, both TBW and JAX had the same issue as I did. There is one very common thing about all 3 of these  'distorted' images. They are radar images rather than normal graphics which all the 'working' sites I look at had.

Hope this helps.

Thanks,

Steve
Title: Re: wxStory 3.0
Post by: Jasiu on August 18, 2022, 02:03:04 PM
What's your URL Steve?
Title: Re: wxStory 3.0
Post by: SteveFitz1 on August 18, 2022, 02:51:10 PM
What's your URL Steve?

https://www.tylertexasweather.com/wxstory.htm (https://www.tylertexasweather.com/wxstory.htm)

This is running the 3.07 version. I downloaded the 3.09 version and tested it, but got the same result 3.07 gives me.

Steve
Title: Re: wxStory 3.0
Post by: Jasiu on August 19, 2022, 09:09:42 AM
SHV isn't showing a radar at this time, but JAX is.  The problem is in this line:

Code: [Select]
<td style="text-align:center"><img src="./wscache/wsimg_jax_KJAX_loop.gif-3a5e55a06dccdad1c7da5476437.6a8" style="width: 700px; height: 400px;" alt=" " /></td>
 

It's the height CSS parameter that is keeping the image from displaying properly. If I interactively remove it (using Firefox developer tools), it's fine.

I'm not familiar enough with the code to determine WHY that height gets in there.
Title: Re: wxStory 3.0
Post by: Jasiu on August 19, 2022, 09:57:03 AM
I also notice that if you click on another tab (like Today) and then back to the radar, it gets the height right. But height isn't really needed in this case as the browser will do the right thing given the width and keep it proportional.
Title: Re: wxStory 3.0
Post by: SteveFitz1 on August 19, 2022, 10:02:48 AM
Jasiu,

Thanks very much for the pointer.

For whatever reason, that "400px" value is set with

$imgheight = 400;

at around line 615 in wxStory_inc.php.

When I change it, it changes the height of the radar images but, fortunately, doesn't appear to change the height of anything else. The radar images are 600 wide and 550 tall. However, the script allows you to set a width that is used across the script. I use 700px. If I set the $imheight = 550, I do get a taller image, but it's still disproportionate. Since my width is 700, I tried a height of 642 to keep the radar image proportionate to 600x550. And this works. You can tell it's slightly stretched, but it looks a lot better than being smashed down.

Thanks again for the assistance.

Steve
Title: Re: wxStory 3.0
Post by: jmcmurry on August 20, 2022, 06:06:57 AM
I'm sorry, bu I'm going through a "week from hell" and will have time to look at this next week.  - Jim
Title: Re: wxStory 3.0
Post by: SteveFitz1 on August 20, 2022, 09:04:14 AM
I'm sorry, bu I'm going through a "week from hell" and will have time to look at this next week.  - Jim

Hey Jim,

There's no hurry for me. Changing the $imgheight variable has circumvented the issue for me for now.

Steve
Title: Re: wxStory 3.0
Post by: Jasiu on August 20, 2022, 10:47:25 AM
Another fix might be to modify line 756:

Code: [Select]
<td style="text-align:center"><img src="<?php echo $wsimg ?>" style="width: <?php echo $tablewdth;  ?>px; height: <?php echo $imgheight ?>px;" alt=" " /></td>

and get rid of the height completely.

Code: [Select]
<td style="text-align:center"><img src="<?php echo $wsimg ?>" style="width: <?php echo $tablewdth;  ?>px;" alt=" " /></td>

The browser should set a proportional height to keep the image height/width ratio the same as the original. That should work if even if the source (weather.gov) changes the image dimensions in the future.
Title: Re: wxStory 3.0
Post by: SteveFitz1 on August 20, 2022, 02:52:44 PM
Jasiu,

Thanks for the suggestion. I tried that and it works for me. And, as you said, it still proportions the image correctly even if the NWS decides to reformat the size of the radar image.

Appreciate the assistance.

Steve
Title: Re: wxStory 3.0
Post by: jmcmurry on August 24, 2022, 09:19:30 AM
I've updated the .zip file in the first post in this thread with Version 3.10.  Jasiu's great solution was what was needed.  - Jim
Title: Re: wxStory 3.0
Post by: chief-david on August 24, 2022, 02:37:51 PM
can that be put in the status updates for the Saratoga templates?
Title: Re: wxStory 3.0
Post by: saratogaWX on August 24, 2022, 03:03:24 PM
If you mean in the check-fetch-times.php?show=versions Version checker for the Saratoga template set, then sorry, no.  Jim's script set is an addon that is not distributed by me in the Base distribution.  Like many addon scripts, you'll need to keep following the postings here or other mechanisms like twitter feeds by the author of the addon script for update notifications.
Title: Re: wxStory 3.0
Post by: hcorrin on October 25, 2022, 02:49:30 PM
in case you have missed it https://www.weather-watch.com/smf/index.php/topic,72945.0.html
Title: Re: wxStory 3.0
Post by: Vasco on October 25, 2022, 03:24:46 PM
And https://www.wxforum.net/index.php?topic=44542.msg452761#msg452761
Title: Re: wxStory 3.0
Post by: hamdrew on February 21, 2023, 03:11:14 PM
Thanks for your work on this. Would you be interested in doing some open source best practices, such as publishing this code in a GitHub repository and Composer package? I have experience with this and would be happy to help.
Title: Re: wxStory 3.0
Post by: W3DRM on February 23, 2023, 12:21:10 PM
First of all, I am saddened to hear about Jim McMurray. He was always willing to help anyone having issues with their code and websites. He will be missed.

I am in the process of getting my new website up and running after a move to Idaho from Nevada. At the moment, I am working on WXSTORY. It is running but I am getting intermittent error messages as shown below:

     Deprecated: Implicit conversion from float 393.75 to int loses precision in /homepages/10/d942756231/htdocs/wxStory_inc.php on line 708
     Deprecated: Implicit conversion from float 393.75 to int loses precision in /homepages/10/d942756231/htdocs/wxStory_inc.php on line 709

If I refresh the page the error goes away and sometimes the error does not show but it is unpredictable. Am wondering if it has something to o with the cache data. Any thoughts or suggestion on the matter would be appreciated.
Title: Re: wxStory 3.0
Post by: rrrick8 on December 06, 2023, 05:22:33 PM
Been a while since I checked on status of those absent offices... looks like San Francisco and Seattle have now joined the wxStory communities.
Title: Re: wxStory 3.0
Post by: scottct1 on December 08, 2023, 12:23:30 PM
Just downloaded this and it does not seem to have a wxstory.php file.  What did I mess up? :)
Title: Re: wxStory 3.0
Post by: Silversword on December 08, 2023, 01:33:22 PM
Hi All,

Guess that Hawaii, Alaska and other US Territories are still not doing this.

How or who can I ask to see if the NWS office will be able to include a Story?

What if, they are interested to do this, as to where and what they will put the story info?

Any suggestions or recommendations welcome.

Happy Holidays and stay safe and healthy,

Aloha,

--Stan Y.
  Maui, Hawaii
Title: Re: wxStory 3.0
Post by: rrrick8 on December 08, 2023, 06:56:51 PM
Hi All,

Guess that Hawaii, Alaska and other US Territories are still not doing this.

How or who can I ask to see if the NWS office will be able to include a Story?

What if, they are interested to do this, as to where and what they will put the story info?

Any suggestions or recommendations welcome.

Happy Holidays and stay safe and healthy,

Aloha,

--Stan Y.
  Maui, Hawaii

They are all on the home page of the WFO's.  The MIC of the office would be a good one to contact.                                                                                                                                                                                                                       
Title: Re: wxStory 3.0
Post by: DaleReid on December 09, 2023, 02:04:34 PM
WTF? IDK WYS.

I don't know what a WFO or MIC is from this conversation.

I know many might mumble these short forms in their sleep, but those seeking help may benefit from fully spelled out phrases and also an example if the responder has time.

And to update Silversword, Hawai'i and Alaska are now states, so they shouldn't be grouped as other US Territories.  Yeah, my 8th grade grammar teacher still haunts me at night.

One thing about programming and station adjustments, a single character or space can have a whole different meaning, so I hope the help provided will be accurate and concise.

I know a doctor who says that when a patient has an "MI" he spells it out since that could be shorthand for Myocardial Infarction or Mitral Insufficiency.  Same initials, vastly different meanings for the patient.

I see Jim's station is now been truly offline on the Blitzortung site.  For some months after his sad passing it still was being used to locate strikes and I was happy that someone in the family kept the power on and the antenna connected.  It's possible that the equipment isn't even there any more (Cutty may know, or Greg) but as was hinted in this thread, he was an amazingly helpful and patient person in helping others get into the hobby.

Keep on enjoying, folks. 
Title: Re: wxStory 3.0
Post by: Silversword on December 09, 2023, 02:30:06 PM
Hi All,

Thanks Dale for my comment for places that I mentioned.

My bad in grammar mention the States of Hawaii and Alaska and other U.S. Territories. One word can make a difference.

Anyway, I hope that our WFO will be able to create something here for visitors.

Have a good safe and stay healthy for this Holiday Season.

Aloha,

--Stan Y.
   Maui, Hawaii
Title: Re: wxStory 3.0
Post by: DaleReid on December 09, 2023, 03:42:56 PM
I know.  In my previous life I worked with a lot of documents which bordered on legal, and we would try to write carefully and the old habit is hard to leave behind (that plus my thickening arteries above the collar bone don't always jump to the obvious and need concrete examples!)

I think this is why, when Python computer language is touted as being a great one to learn in grade school, that I'm pulling my hair out with studying for years and not being able to program or find the mistakes in other's work.  One person's clarity is another's confusion.

Peace and enjoy the weather, no matter where (it's snowing here right now, but wet chilly stuff).Dale