Author Topic: raintoday.gif not updated in web  (Read 580 times)

0 Members and 1 Guest are viewing this topic.

Offline mldenison

  • Contributor
  • ***
  • Posts: 111
    • York, PA Weather
raintoday.gif not updated in web
« on: July 14, 2021, 12:03:59 PM »
Hi Folks,

I'm having a display issue with the raintoday.gif being generated by WD.

My web page is not refreshing the image.  It's being correctly created by WD and uploaded to my web site.

However, the old image is being displayed from yesterday's rain.  I had .03 in rain yesterday and .00 in of rain today.  The image displayed shows .03 in of rain but the web image shows .00 in of rain.  The web image must be cached somewhere.

I'm using the alternate ajax-dashboard6 for my website and recently upgraded the 'c' version to the 'd' version.

The 'c' version worked correctly and I'm perplexed as not being able to figure out why the 'd' version doesn't.

Ant help is appreciated!

Thanks,
Mort

https://www.m82a1.us/index.php
Windows 7 x64
Weather PC: Intel NUC
Davis Vantage Pro 2
Weather Underground: KPAYORK30
York, PA Weather (Saratoga)
York, PA Weather (Leuven)
York, PA PWS Station

Offline lddaly

  • Forecaster
  • *****
  • Posts: 490
Re: raintoday.gif not updated in web
« Reply #1 on: July 14, 2021, 12:41:18 PM »
I use this method to prevent the caching:
Code: [Select]
<?php echo "<img src='./WD-webfiles/raintoday.gif?" filemtime('./WD-webfiles/raintoday.gif') . "' width='178' alt='rain graph'/>";?>Also for heavenpie.png:
Code: [Select]
<?php echo "<img src='./cache/heavenpie.png?" filemtime('./cache/heavenpie.png') . "' height='100' width='100' alt='pie chart'/>";?>

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: raintoday.gif not updated in web
« Reply #2 on: July 14, 2021, 01:19:42 PM »
I think the issue may be due to caching enabled on your website.  The response headers for raintoday.gif shows
Code: [Select]
    HTTP/2 200 OK
    server: nginx
    date: Wed, 14 Jul 2021 17:13:57 GMT
    content-type: image/gif
    content-length: 2255
    x-sucuri-id: 11033
    x-xss-protection: 1; mode=block
    x-frame-options: SAMEORIGIN
    x-content-type-options: nosniff
    content-security-policy: upgrade-insecure-requests;
    last-modified: Wed, 14 Jul 2021 17:13:46 GMT
    etag: "478d4e6-8cf-5c7187a343424"
    expires: Thu, 31 Dec 2037 23:55:55 GMT
    cache-control: max-age=315360000
    x-sucuri-cache: MISS
the combination of a long max-age+expires means your browser won't fetch a new copy for years.

Use your cPanel to turn off Sucuri Cache on your website to fix the issue.
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 saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: raintoday.gif not updated in web
« Reply #3 on: July 14, 2021, 02:00:24 PM »
lddaly's method works, As does the below.  You can 'fake out' the cache by adding an argument to the request, so the cache thinks it's a CGI generated image, so doesn't cache it.

In ajax-dashboard6.php, change
Code: [Select]
<img id="RainGraph" src="<?php echo $RainGraphImage ?>" width='178' alt="rain graph" /> to
Code: [Select]
<img id="RainGraph" src="<?php echo $RainGraphImage.'?t='.time(); ?>" width='178' alt="rain graph" />
and change
Code: [Select]
<img style="width:80px; margin-left:auto; margin-right:auto" src="cache/heavenpie.png" alt="graph" width="80px" height="80px" id="HeavenPie"/> to
Code: [Select]
<img style="width:80px; margin-left:auto; margin-right:auto" src="cache/heavenpie.png<?php echo '?t='.time(); ?>" alt="graph" width="80px" height="80px" id="HeavenPie"/>
« Last Edit: July 14, 2021, 02:02:29 PM by saratogaWX »
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 mldenison

  • Contributor
  • ***
  • Posts: 111
    • York, PA Weather
Re: raintoday.gif not updated in web
« Reply #4 on: July 14, 2021, 02:01:56 PM »
Thanks!

I'll do it today.

Mort
Windows 7 x64
Weather PC: Intel NUC
Davis Vantage Pro 2
Weather Underground: KPAYORK30
York, PA Weather (Saratoga)
York, PA Weather (Leuven)
York, PA PWS Station

Offline mldenison

  • Contributor
  • ***
  • Posts: 111
    • York, PA Weather
Re: raintoday.gif not updated in web
« Reply #5 on: July 14, 2021, 02:14:29 PM »
The only heavenpie in the php code was this:

Code: [Select]
<span class="thisPage" style="font-size:7px; line-height:130%">(Noon)</span>
<a class="hvr-glow hvr-grow" href="<?php echo $sunLightPieLink?>" target="_blank" title="Astronomy Page in New Tab"><img style="width:80px; margin-left:auto; margin-right:auto" src="cache/heavenpie.png" alt="graph" width="80px" height="80px" id="HeavenPie"/></a>

I just left that one unchanged.
Windows 7 x64
Weather PC: Intel NUC
Davis Vantage Pro 2
Weather Underground: KPAYORK30
York, PA Weather (Saratoga)
York, PA Weather (Leuven)
York, PA PWS Station

 

anything