cloudy

Author Topic: Weather Web Cam Images History PHP Script and Template Plugin  (Read 17998 times)

0 Members and 1 Guest are viewing this topic.

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Weather Web Cam Images History PHP Script and Template Plugin
« Reply #60 on: January 19, 2009, 03:51:02 PM »
Hello Mike!,
i use your scrpt by 2-3 month and now i have make a change , i have remove the page with thumb and i have create a slideshow page with my 150 last image...

now my question, with this good mode of capture is possible to make a video of xx images with another script? yes?..

i have linux web (php) and i use a old Canon A400 for cam, this is the page (secret for now!..to test) http://www.meteomasiera.it/wxslide5.php

tnx in advance, Raf...ooooppps!  CONGRATULATION FOR THIS SCRIPT !!


I have tested making videos before.
Here are some facts I determined: 
My cam only uploads an image every 5 minutes.
Videos will look better with every 1 minute uploads, I did not want to do that.
The file size of the videos are going to be large unless you do a lot of processing. This processing could be done on your home computer, then the file uploaded, or done on the web server. Processing video compression on the web server might require root shell access to install. Processing the video on the home computer would obsolete my PHP web cam scripts.
Some guests to your web site may not have the correct software installed to view the videos.

This all gets rather complicated.

I decided that weather underground video was the easiest to add.
You can see my WU 24 hour timelapse video on the bottom of my cam page here:
http://www.642weather.com/weather/cam.php

If you set up upload your web cam image to send to WU then they make the video automatically. All you have to do is link to it.
Here is the script to upload to WU:
http://www.642weather.com/weather/scripts-weather-cam-uploader.php


Offline rafid

  • Posts: 23
  • Bagnacavallo, Ravenna, ITA
Re: Weather Web Cam Images History PHP Script and Template Plugin
« Reply #61 on: January 19, 2009, 07:07:01 PM »
thank you for your quick response Mike !

i imagine the big process..tnx..no problem, i have also WU video..but i dont like (big compression!)
i have my video section maked by hand! (seqdownload..ecc)  but you know not is possible every day
to make for family or work problem..

in any case thanks again for your script because is simple and useful..
good work ..ready for any your new script.. Ciao, Raf


Offline skyewright

  • Posts: 1,994
  • Isle of Skye, Scotland
    • 24 Elgol
Re: Weather Web Cam Images History PHP Script and Template Plugin
« Reply #62 on: March 02, 2009, 02:14:47 PM »
A little while ago Mike provided some optional extra code to allow offsetting of $dayornight. I use that code to extend the 'day' by 60 minutes at the start and end, which is just about right to make the most of daylight with my Panasonic BL-C140 on a clear day. Thanks Mike.  :D

I've now taken that idea and run a little further with it to allow to the archive to vary in size so that it always has slightly more than a days worth of 'daylight' images - yesterday that was 153, today 154.

Maybe others would be interested too? If so here's what I did...

Edit: N.B. This optional modification aims to maintain the archive size at only slightly more than one daylight day's worth of files. If you have a larger archive than that and start using the modification, the extra files will be deleted the first time the code runs! Unless you have made a backup of those extra files will then be lost.

In the testtags.txt template in the WD webfiles folder I added this at the bottom (should be after Mike's earlier code, as I use his $night_offset minutes and $day_offset minutes values).
Code: [Select]
$webcamDayMinutes = round( ( strtotime("$sunset $night_offset minutes") - strtotime("$sunrise $day_offset minutes") ) / 60 );

Then in image-webcam-overlay.php, just after
Code: [Select]
# How many archived images will be stored
$archivecount = 150;
I added
Code: [Select]
# skyewright: $archivecount set from a variable calculated by testtags based on day length.
if ( $webcamDayMinutes )
{
   $archivecount = round( $webcamDayMinutes / 5 ) + 1; # N.B. Assumes 5 minute upload frequency.
}

As the days grow longer (as is happening here now  :D) that's all that is really needed, but in the autumn as the days shorten and archivecount decreases, extra code is needed to delete excess files as they become redundant.
To allow for that, just before
Code: [Select]
# add newest filein image-webcam-overlay.php, I added
Code: [Select]
# skyewright: remove excess files
$xsFiles = 0;
$xsFileCheck = 1; # Set to 0 to suppress the check.
# If $xsFileCheck is not 0, the code will loop till it fails to find a file to delete.
while ( $xsFileCheck )
{
      $xsFileCheck = 0; # unset at start of each loop cycle.
      $xsFiles += 1; # increment
      $checkNumber = $archivecount+$xsFiles;
      $targetfile = $archivedir . $archivefilepre . $checkNumber . '.' .$FileType;
      $targetfilethm = $archivedir . $archivefilepre . $checkNumber . '-thm.' .$FileType;
      if (file_exists($targetfile))
      {
        unlink($targetfile);
        $xsFileCheck = 1;
      }
      if ($archivewiththumbs and file_exists($targetfilethm))
      {
        unlink($targetfilethm);
        $xsFileCheck = 1;
      }
}
A PHP guru could probably do that more neatly, but if I artificially create excess files they get tidied up, so it seems to work. :-)
« Last Edit: March 04, 2009, 08:46:16 PM by skyewright »
Regards
David

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Weather Web Cam Images History PHP Script and Template Plugin
« Reply #63 on: March 02, 2009, 02:35:37 PM »
Nice idea David, nice work.   :D

Offline vk2him

  • Posts: 411
  • Gerringong, NSW, Australia
    • The Shack by the Beach
Re: Weather Web Cam Images History PHP Script and Template Plugin
« Reply #64 on: March 04, 2009, 08:53:00 AM »
Hi David

I installed your code but it seems to have caused me problems ..

I have images archived since late December 2008, however after installing this code I only have links to a few days worth. Also, some of the thumbnails that display don't link through to the full size images. I have checked and the images are still there, its just the index seems to be out of sync??

I have uninstalled it for now, but I'm not sure how to rebuild the page index so all my archive images from December 2008 appear again?

Thanks
Ian

Offline skyewright

  • Posts: 1,994
  • Isle of Skye, Scotland
    • 24 Elgol
Re: Weather Web Cam Images History PHP Script and Template Plugin
« Reply #65 on: March 04, 2009, 02:23:55 PM »
I have images archived since late December 2008, however after installing this code I only have links to a few days worth. Also, some of the thumbnails that display don't link through to the full size images. I have checked and the images are still there, its just the index seems to be out of sync??

I have uninstalled it for now, but I'm not sure how to rebuild the page index so all my archive images from December 2008 appear again?
I'm more than a little puzzled over why you tried to use the modification.

The whole aim of the modification is to maintain the archive at only slightly more than one daylight day's worth of files.

If there are more files than that the code intentionally deletes the excess. So if you want to keep more than just daylight day's worth of files then the modification is not at all appropriate.

The logic for removal is that starting from a number 1 greater than the archivecount it builds the name for the full size file and the thumbnail for that number, if either (or both) such files can be found they are deleted. That process loops, incrementing the number by one each time until neither the full size file nor the thumbnail file for that number exist, i.e. it stops once it reaches a discontinuity in the numbered sequence of files (which may explain why some files remain beyond "just a day's worth").

The "page index" is just based on a directory listing of files in the archive folder that match the pattern of thumbnail filenames. The way to "rebuild" the page index would be to restore the image files (both full and thumbnail) from a backup (which I sincerely hope you have).

« Last Edit: March 04, 2009, 02:33:12 PM by skyewright »
Regards
David

Offline vk2him

  • Posts: 411
  • Gerringong, NSW, Australia
    • The Shack by the Beach
Re: Weather Web Cam Images History PHP Script and Template Plugin
« Reply #66 on: March 04, 2009, 06:25:30 PM »
Thanks David,  I misunderstood the intention of the code  #-o
I thought it stored the number of archives each day based on the length of day, up to the maximum limit set.

Cheers

Offline skyewright

  • Posts: 1,994
  • Isle of Skye, Scotland
    • 24 Elgol
Re: Weather Web Cam Images History PHP Script and Template Plugin
« Reply #67 on: March 04, 2009, 08:35:18 PM »
Thanks David,  I misunderstood the intention of the code  #-o
I thought it stored the number of archives each day based on the length of day, up to the maximum limit set.
Sorry for any misunderstanding.  :(
I'll add an extra warning to the earlier post lest anyone else misunderstands the consequences of using it.
Regards
David

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Weather Web Cam Images History PHP Script and Template Plugin
« Reply #68 on: November 05, 2009, 06:00:43 AM »
Version: 1.02  04-Nov-2009
- Improved thumbnail image links. Better JavaScript link method.

Changed a couple things in cam-history-inc.php

Offline Peter Palm

  • Peter
  • Posts: 456
  • It aint much, if it aint Dutch haha ;-)
  • Grave, the Netherlands
    • Weatherstation Grave - Holland
Re: Weather Web Cam Images History PHP Script and Template Plugin
« Reply #69 on: May 13, 2010, 05:17:23 PM »
Hi Michallis, I've got it working too.
I'm not using it with tags, nor with the template, but it works :)
See the archive page.

I've also made a small viewer with which you can animate the images by moving your mouse over the timeline.
Click in the right top corner on "Tijdlijn" for a nice way to animate or inspect the images with your mouse.
« Last Edit: May 16, 2010, 03:19:52 AM by Peter Palm »

Offline folignometeo

  • Posts: 42
Re: Weather Web Cam Images History PHP Script and Template Plugin
« Reply #70 on: June 21, 2010, 07:21:55 PM »
Hi Michallis, I've got it working too.
I'm not using it with tags, nor with the template, but it works :)
See the archive page.

I've also made a small viewer with which you can animate the images by moving your mouse over the timeline.
Click in the right top corner on "Tijdlijn" for a nice way to animate or inspect the images with your mouse.

Beautiful script Peter!!!
Do you think release it for public?
There is any way to integrate it in saratoga template??

Regards, Alex

Offline kaimaikid

  • Posts: 33
  • It was this big....
  • Tauranga, New Zealand
    • Welcome Bay Weather
Re: Weather Web Cam Images History PHP Script and Template Plugin
« Reply #71 on: August 15, 2010, 12:08:58 AM »
Thanks Mike another great script....

I have installed it on my site

http://kiwiradio.blakjak.net/wxcam-history.php

However I was wondering after trying not successfully to change the click action on thumbs to display like Lightbox 2?

I could do it manually which would take some time or use some sort of auto-script but I wish to keep the Day/Date/Time description under the thumbs

 

cumulus