Author Topic: Weather Graphics/Icons/Logos  (Read 3043 times)

0 Members and 1 Guest are viewing this topic.

Offline ADM

  • Contributor
  • ***
  • Posts: 135
    • Barrow County Weather - Barrow County, Georgia
Weather Graphics/Icons/Logos
« on: September 06, 2008, 10:42:12 AM »
Are the weather "stickers" such as in wxgraphics (Anole) automatically updated should another visitor place one on their website or does it require a page refresh?

Thanks!

Al...

Offline SLOweather

  • Global Moderator
  • Forecaster
  • *****
  • Posts: 3456
    • Weatherelement Moline IL
Re: Weather Graphics/Icons/Logos
« Reply #1 on: September 06, 2008, 11:22:43 AM »
Anole's graphic is a PHP script, and, in normal usage, is constructed new every time it's called by a page. However, the data is only as new as the upload time of the data file the script is using.

Offline ADM

  • Contributor
  • ***
  • Posts: 135
    • Barrow County Weather - Barrow County, Georgia
Re: Weather Graphics/Icons/Logos
« Reply #2 on: September 06, 2008, 11:54:27 AM »
Thank you for the clarification.  So there is no real way for the image to be refreshed "automatically" unless a user does a page refresh?

Offline SLOweather

  • Global Moderator
  • Forecaster
  • *****
  • Posts: 3456
    • Weatherelement Moline IL
Re: Weather Graphics/Icons/Logos
« Reply #3 on: September 06, 2008, 12:26:12 PM »
That's a question better left to more skilled programmers than I am. I wonder if an Ajax sticker could be created, and how it would muck up a page with other AJAX on it.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9296
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Weather Graphics/Icons/Logos
« Reply #4 on: September 06, 2008, 12:53:26 PM »
Add a little JavaScript, and an image can be refreshed automatically without reloading the page.  I use this simple script for my webcam thumbnail (uploaded every 15 seconds) to keep it refreshed on my webpage.   You could replace the <img src="...jpg" .. /> with the url for the weather graphic PHP script and it would work just the same.

Code: [Select]
    <p>Get a <a href="sticker.php">weather graphic.</a></p>
    <a href="netcam.php"><img src="netcam-thumb.jpg" id="myPull" alt="Netcam facing North-East" width="120" height="90" /></a>
    <p>See <a href="netcam.php">live netcam</a>.</p>
<noscript><p style="color:#FF0000"><b>Note:</b> enable JavaScript to see updated image and live weather updates.</p></noscript>
<script type="text/javascript"><!--
//<![CDATA[
function reloadImage() {
    var now = new Date();
    if (document.images) {
        document.images.myPull.src = 'netcam-thumb.jpg?' + now.getTime();
    }
    setTimeout('reloadImage()',15000);
}

setTimeout('reloadImage()',15000);
//]]>
-->
</script>

The JavaScript appends a '?timestamp' to the URL to make sure the browser doesn't cache the image.

Hope this helps...
Best regards,
Ken
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 ADM

  • Contributor
  • ***
  • Posts: 135
    • Barrow County Weather - Barrow County, Georgia
Re: Weather Graphics/Icons/Logos
« Reply #5 on: September 06, 2008, 01:19:33 PM »
Excellent!  and many thanks once again!!!

Al...