cavemonkey50’s Webcam Update Script

Current Version: cavemonkey50’s Webcam Update Script 1.5

This PHP script will determine if a webcam image has been updated in a set amount of time. If it has been updated, it will display the webcam image; if it hasn’t it will display other content.

Installation

Open webcam.php with your favorite text editor and configure the variables at the top of the script. Then replace the three HTML spots with your specific HTML code.

Usage

Call the script within a PHP page with the following line of code:

<?php readfile("http://location.to/webcam.php"); ?>

Download cavemonkey50’s Webcam Update Script

Current Version: 1.5
Released: 2005-11-03

Download cavemonkey50’s Webcam Update Script 1.5

Version History

1.5 - Minor Update

  • Updated script to be more user friendly.

1.0 - Initial Release

Sponsored: Live Web Cam Chatten Webcam chat

16 Comments

  1. 1 Adrian on Jan 14, 2006 at 1:10 am (Quote):

    i try your script to view my webcam image but it doesn’t work. :sad:

    please take a look at http://adrian.bahana.net/webcamimg.php (this is your script), the result is always offline.

    my online webcam page can be found at http://adrian.bahana.net. click it to view refreshed webcam image (every 3 seconds) in a pop-up window.

    fyi, i also wrote a tutorial about installing webcam in gnu/linux box (in bahasa Indonesia), please come to http://adrian.bahana.net/2005/09/07/instalasi-webcam-di-gnulinux/

    sorry about my english. :grin:

  2. 2 cavemonkey50 on Jan 15, 2006 at 4:46 pm (Quote):

    Adrian, it appears that it’s working when I visit your site. Did you get it working or are you still having problems?

  3. 3 Adrian on Jan 18, 2006 at 4:52 am (Quote):

    oops! sorry. it’s my false. your script is working well.

    i forgot to set permission on the image directory.

    thank you brother!

  4. 4 Ryan on Aug 23, 2006 at 3:13 am (Quote):

    I have my site running on another server and my webcam is running on a computer at my home which uploads a webcam image every 30 seconds to the web folder on the computer. Now in directory field i put http://computersIP/ and the webcam image i put webcam.jpg and refresh at 70 seconds.

    I tested the link to the webcam image and it works fine.

    Now i haven’t made a webcam down page but looking at the source code for the html, it’s loading the offline page. Take a look for yourself http://coldcoloradan.com/webcam/webcam.php

    Now is it possible to put a http:// link instead of the server directory since it’s on another server? For example

    $file = “cavecam.jpg”; // The name of the image
    $dir = “http://60.60.123.4/”; // The directory the image resides (using full server path)
    $time = 60; // How long the webcam should be displayed before considered offline (in seconds)

    Let Me know.. Thanks

  5. 5 Ronald Heft on Aug 23, 2006 at 5:49 pm (Quote):

    No, it’s not possible for it to work on another server. The reasoning is PHP has no way to view when the image was updated on another server. It needs to be installed locally to retrieve file attributes.

    However, the script can be called remotely. So, if you wanted to install PHP on your webcam server, and call the script from your site, that can be done.

  6. 6 Ryan on Aug 23, 2006 at 7:33 pm (Quote):

    How would i call the script remotely?

  7. 7 Ryan on Aug 23, 2006 at 7:39 pm (Quote):

    Actually is there a way just to see if the server is up or down.

    For example if the server is up it would load the webcam up page
    and if it’s down, it would load up the webcam down page on my website.

    Pretty much my computer is on a scheduel to shut down at 10:30PM and start up at
    5:00AM. Well in between those times i would like a script to see that the server is down and display the webcam down page.

    Do you know any way of doing this?

  8. 8 ivan123 on May 24, 2007 at 5:53 pm (Quote):

    hello!

    Scripts looks fine but where i gave to put my IP number - where the web cam is - and it will give the pictures for the web-site?

  9. 9 Ronald Heft on May 25, 2007 at 3:10 pm (Quote):

    Yes, in the section for an online webcam, just place the image HTML for your webcam.

  10. 10 Ken on Oct 29, 2007 at 4:39 pm (Quote):

    Ronald,

    Love your simple webcam update script. However, I need to display the latest image file in a series of files named with a time stamp, rather than the same filename. (Camera takes one pic every three minutes, always with a new file name.) I’m guessing that’s not too hard for someone who’s not as rusty at PHP as I am. Hint, hint…

  11. 11 Ronald Heft on Oct 30, 2007 at 12:12 am (Quote):

    Ken: Ronald,

    Love your simple webcam update script. However, I need to display the latest image file in a series of files named with a time stamp, rather than the same filename. (Camera takes one pic every three minutes, always with a new file name.) I’m guessing that’s not too hard for someone who’s not as rusty at PHP as I am. Hint, hint…

    Ken, I can point you in the right direction. You want to use the scandir function and grab the first item in the array. If you’re looking for more assistance, I am available for hire.

  12. 12 Jim Seymour on Nov 6, 2007 at 9:20 pm (Quote):

    Hello,

    I hate to be the only one in here that cannot figure out the script, however it looks like I am. I am not a coder of php or html other than the basics. That said, I have been unable to figure out what your script wants in the area the install directions say to edit in the webcam.php file where it says:

    I have tried the which made sense but displays nothing with the script although the same line loads the image when used in the address bar of a browser. I am trying to use this with a wordpress site and get away from javascript that breaks on every Wordpress upgrade. I don’t need the exact code, just a little more direction than the others needed. This is needed to reload a .jpg file that updates every 10 seconds (simple webcam).

    Thanks,
    Jim

  13. 13 Jim Seymour on Nov 7, 2007 at 4:19 pm (Quote):

    Hi,

    What was stripped out of my first post was this. I do not understand what I am supposed to add where the instructions say.
    “Then replace the three HTML spots with your specific HTML code.”
    Adding img tags does nothing in the webcam.php file. They do not even show up when viewing the source code from the website. I just need some pointers.

    Thanks,

    Jim

  14. 14 Ronald Heft on Nov 7, 2007 at 8:43 pm (Quote):

    Jim, if you’re trying to reload an image live on the page, this script isn’t for you. What this scrip does is display an offline indicator if your webcam stops broadcasting.

  15. 15 santosh on Feb 20, 2008 at 4:54 am (Quote):

    hey
    can anyone give those 3 html codes (active,inactive,image does not exist)…atleast give me the suggestions, i am very much new to the coding…….i want to know the magic behind this code .

    Please “cave monkey50″, “Adrian”….any one else

  16. 16 ket on Jun 9, 2008 at 11:21 pm (Quote):

    Can anyone show it in action?

One Trackback/Pingback

  1. [...] Thanks to Jonathan, I got the bug to fix up cavemonkey50’s Webcam Update Script. I rearranged and simplified things, making it easier to edit for other’s needs. After working with the script for a little, I now deem the script ready for public release and I have created a page for it. [...]

Post a Comment

If you have the urge to code, run it through Postable and <pre><code>wrap it up</code></pre>.