New Script Help

Hi,

I am trying to develop a new page for my website that uses a series of 15 png files to forecast rainfall over a certain time period. An example of the the file and where I am getting it from is below,

ftp://ftp2.bom.gov.au/anon/gen/fwo/IDY20301.mslp-precip.003.png

What I want to do is show each file for perhaps 2 seconds to give it an animated appearance. As an example, it would show the above file for 2 seconds then the next for 2 seconds etc etc…

ftp://ftp2.bom.gov.au/anon/gen/fwo/IDY20301.mslp-precip.003.png
ftp://ftp2.bom.gov.au/anon/gen/fwo/IDY20301.mslp-precip.006.png
ftp://ftp2.bom.gov.au/anon/gen/fwo/IDY20301.mslp-precip.009.png
ftp://ftp2.bom.gov.au/anon/gen/fwo/IDY20301.mslp-precip.012.png

And so on until 0.48png

Does anybody have any ideas how I could do this??

Thanks.

No idea what the images are and the browser doesn’t recognise the URLs but have you looked at the built-in antimator that WD has?
You’ll find an FAQ about the setup here: http://discourse.weather-watch.com/t/30381

the forums are adding the http:// on … just delete the first http://

Yes you need to remove the initial http:// to see the images.

I had looked into using WD to download the images and animate but I couldn’t get WD to download the images

Plus from what I could tell I don’t think you can download 15 seperate images - it seems to imply that you can only download and save one image or 3 setups - I could be wrong.

No, you’re not wrong.
As the source you’re using doesn’t produce a “Now” image, as in the case of the satellite image I use, then my suggestion is not a valid one.

You will need something like a cronjob on the server to download the images once they are updated and some Java script to display them.

Look for flanis, it’s a Flash script for doing a slideshow like you are trying to do. I use it for a 6 hour animation of satellite images, 25 images, 15 minutes between captures.

You can see it in action here: http://www.hamiltonweatheronline.net/wxsatellite2.php

George

Very nice satellite loop. I use flanis for my radar. How are you capturing the satellite images since they are dynamic images?

To the original poster, flanis would be the way to go but from what I’ve learned with it you are restricted as far as width and size goes so those images may not fit. If they do I would go with it since those are static images and flanis is real easy to use

Very nice satellite loop. I use flanis for my radar. How are you capturing the satellite images since they are dynamic images?

Nick,

I use Mike Challis’ image handler script, with some mods to grab the static images. I “tickle” it with a VB script every 15 minutes via Windows Task Scheduler to simulate a cron event, my hoster doesn’t support cron.

George

Thanks for this suggestion - it looks like flanis could do the jop quite nicely… if I can get it up and running!!!

I have playing with this for a couple of hours now and I am really getting confused with the filenames, overlay_filenames and overlays.

As a test I am only using 3 images so far - I have got it working to a point but I keep getting error messages in my test page.

This is a copy if my config file,

backcolor=0x800000
controls=startstop, speed, zoom, show, looprock, /refresh, location/on, probe/on
bottom_controls=overlay,toggle
#controls=setframe

#active_zoom=true
bottom_controls = toggle
#no_controls=true

content_position=20,20
start_frame = 1
toggle_onoff = 1,0,1

zoom_scale = 10.0
controls_gap=1
probe_style=0xff00ff,0x00ff00
use_caching=true
use_anti_caching = false
filenames = ftp://ftp2.bom.gov.au/anon/gen/fwo/IDY20301.mslp-precip.003.png, ftp://ftp2.bom.gov.au/anon/gen/fwo/IDY20301.mslp-precip.006.png, ftp://ftp2.bom.gov.au/anon/gen/fwo/IDY20301.mslp-precip.009.png
frame_label = one, two, three
#frame_label_style=0x000000, 0xffffff,20,30
overlay_filenames = play/TSFC0.GIF&play/TSFC1.GIF&play/TSFC2.GIF, play/mask0.gif&play/mask1.gif&play/mask2.gif

transparency = 0x000000
#dwell_rates=300,500,1000
image_preserve=0,0,640,20, 100,380,200,400

debug=true

coordinates=50,-109,30,-76
coordinates_style = 0x40808080, 0x000000, , LAT=, LONG=, 3
location_label=LatLon
map_scale=10

toggle_size=5,10,20

overlay_labels=Surface Data, Some Data/mask
overlay_labels_placement = 10&0, 10&20
overlay_labels_color=0xff00ff,0xffff00
overlay_labels_mouseover_color=0xffffff,0x00ff00
#pause=100
minimum_dwell = 10
rate = 100
#rocking=true
keep_zoom=true

#hotspot=0,0,10,10,url,http://testing
#hotspot1=10,10,10,10,fof,my_fof.txt
#hotspot2=100,100,10,10,popup,my_fof.txt
#hotspot3=150,150,10,10,fof,my_fof.txt150
#hotspot4=200,200,10,10,fof,my_fof.txt200

This is a link to my test page with debug information on it,

http://www.micklehamweather.com/wxrainforecastmodelstest.php

I get the following error message ******** Error: Number of overlay files must equal number of overlay_labels

I have played around with the ‘overlay_filenames’ line and tried a number of different variations, including the same paths to my 3 files in ‘filenames’, but I just keep getting the same error message. So at the moment I have just reverted this line back to the original status from which I downloaded it from (whick I know is probably wrong).

I have also read that there should be one line of code for each overlay image, but I am unsure of where/what.

Any help on this would be much appreciated.

Here is my config.txt file I modified for you that I use for my radar. It is very simple and streamlined. Give it a try and get it working and you can go from there. It has everything you need as far as options and if not you can add them in later once you get it going. One thing I am not sure about and I could be wrong. I don’t know if you can use absolute file paths, I don’t see why you couldn’t but they may need to be relative to your server. Once again I could be wrong on that though. Anyways, give this a try, when I tested it on my end I could not get the images to load so try saving them on your server and calling them to the script via relative path on your sever for testing and you and you can go from there.

bottom_controls=bottom_controls=startstop, looprock, step, speed, zoom, refresh, toggle

controls_tooltip = Start & Stop, Rock Frames Back & Forth, Step Image One at a Time, Set Frame Speed, Zoom In, Auto Refresh, Click to Remove Frame From Animation

filenames = ftp://ftp2.bom.gov.au/anon/gen/fwo/IDY20301.mslp-precip.003.png, ftp://ftp2.bom.gov.au/anon/gen/fwo/IDY20301.mslp-precip.006.png, ftp://ftp2.bom.gov.au/anon/gen/fwo/IDY20301.mslp-precip.009.png

start_frame = 1 

start_looping = true

rate = 25

auto_refresh = 10

backcolor = #ffffff 
forecolor = #000000

no_enh = true  

Ok I got this to work for you but you are going to need to find a way to capture the images since it uses ftp as the source. Create a folder in your root and call it something like animate and create another folder and call it images put your images in there. Put your flanis folder the animate folder.

Example animation.

http://www.mesquiteweather.net/animate/test.php

In your flanisrainfallmodels.cfg use this.

bottom_controls=bottom_controls=startstop, looprock, step, speed, zoom, refresh, toggle

controls_tooltip = Start & Stop, Rock Frames Back & Forth, Step Image One at a Time, Set Frame Speed, Zoom In, Auto Refresh, Click to Remove Frame From Animation

filenames = images/IDY20301.mslp-precip.003.png, images/IDY20301.mslp-precip.006.png, images/IDY20301.mslp-precip.009.png

start_frame = 1 

start_looping = true

rate = 10

auto_refresh = 10

backcolor = #ffffff 
forecolor = #000000

no_enh = true

inside your animate folder create a file called flanisrainfallmodels.php and put this in it.

<object type="application/x-shockwave-flash" data="../animate/flanis/flanis.swf" width="880" height="550">

    <param name="movie" value="../animate/flanis/flanis.swf" />

    <param name="quality" value="high" />

    <param name="menu" value="false" />

    <param name="wmode" value="opaque" />

    <param name="FlashVars" value="configFilename=../animate/flanis/testconfig.txt" />

</object>

Keep in mind the file paths are relative to the folder structure. If you follow the instructions it will work as followed just get the images and put them in the images folder that’s inside your animate folder. You can then call the animation into your template like this.

<?php include("animate/flanisrainfallmodels.php"); ?>

Then you should be good to go.

For the script to grab and cache the images: http://www.642weather.com/weather/scripts-image-handler.php

That’s the base script that I use with a bit of custom mods to the script for my situation. I cache the 25 images for my satellite page in a sub directory off the root directory of my site, and allow the filenames to be shortened a bit so the flanis config is easier to edit.

My config looks like this:

backcolor=#291F4B
forecolor=#FFFFFF
controls=startstop, looprock, step, speed, firstlast, zoom, refresh, toggle
controls_tooltip=Start-Stop, Rock Frames Back-Forth, Step Image One at a Time, Set Frame Speed, Go to First or Last Image, Zoom In By Clicking Mouse on Image, Refresh Images, Click to Remove Frame From Animation
pause_percent=200
image_window_size=630,630
rocking=false
active_zoom=true
keep_zoom=true
no_enh=true
image_base=./satellite/images/store/
enhance_filename=./satellite/images/store/enh.tab
filenames=satimage24.jpg, satimage23.jpg, satimage22.jpg, satimage21.jpg, satimage20.jpg, satimage19.jpg, satimage18.jpg, satimage17.jpg, satimage16.jpg, satimage15.jpg, satimage14.jpg, satimage13.jpg, satimage12.jpg, satimage11.jpg, satimage10.jpg, satimage9.jpg, satimage8.jpg, satimage7.jpg, satimage6.jpg, satimage5.jpg, satimage4.jpg, satimage3.jpg, satimage2.jpg, satimage1.jpg, satimage0.jpg
debug=false

Hope this helps a bit. :wink:

George

Thanks to both Nick and George for helping me out - I really appreciate it.

I have got it up and running using some saved images I have put on to my webserver.

I had a look at the script to grab the images, but unfortuantly it didn’t work because the path to my images didn’t start with ‘http’ (mine starts with ‘ftp’).

Using WD to download the images didn’t work either so I might need to go back to the drawing board and have a rethink about how I can grab the images.

Thanks again!

This is brilliant. :smiley:

I thank you also Nick and George.

I’ve being using Budgies FAQ for animation but I think I’m going to use some time on this.

It’s a lot like something I’ve imagined getting my own pages to do. http://www.svanekevej.dk/wxEUMETSAT.php

Flemming

I am guessing that the images, all 15, on the BOM site update every 3 hours?

If so, use curl to download the 15 in the series to a subfolder on your site every 3 hours to keep them fresh. Curl should be able to do a rename on the fly so you could have simple filenames to be called by the flanis script rather than the full url’s.
You would have a loop with the curl call within, use the loop counter to change the image number in the url and save the downloaded image with a simple name of your choice tagged with the loop counter value. Then all you would have to do is call the script either via cron or use WD’s http download or use a VB script on your local computer, if it is running all the time, called via the Windows Task Scheduler. I had used the WD method till I had too many scripts being called and switched to the VB script method.

I’d write up a test script, but my brain is like mud right now, haven’t got back into the coding frame of mind. :wink:

George