Archive for the ‘IP Camera Tips’ Category.

How to Embed The Most Recent Uploaded Image – Linksys WVC54GCA

OK, so another common want people have asked me about with regards to embedding their cam on a web page, is how to embed a camera image. I did this with my Linksys WVC54GCA, but this script will actually work with any files. Since this cam has no regular upload interval, I am relying on the motion detection (which is really sensitive) to trigger the upload.

Since I have already outlined how to setup the FTP upload, I am not going to cover that in this post. When you setup your FTP upload, be sure to specify a separate directory to hold your images, as this script is going to look for the most recent file and delete the rest. This is one that some people get hung up on in the FTP setup. Be sure to create your directory (for example the directory might be called images), using an FTP program and then specify the directory path in the cam setup like this: /images.

Links to the image embed script and instructions on how to use it are listed below.
file with last mod time.

Ok, in order for this script to work, your hosting server must be capable of running PHP scripts. You must also know the absolute directory path to your hosting directory. Start by downloading this text file (right click and save as may work the best). Once saved, open it in your favorite text editor. You will need to set the $dirpath variable with your directory path. Save this file as latest.php As suggested above your camera should be uploading it’s images to a directory within your hosting root. Upload latest.php to the same directory your camera is uploading images to. If you change the name of the script or have any other files in this directory that you do not want deleted you must add them to the script below the comment set beginning with ### EXCLUDE HERE. This script will delete all files except for those that have been excluded and the most recent file based on last modified time.

Once the script is in place with your camera images, you can test it by accessing it directly. Mine is located here. Next, you can include this file in a separate php file using include 'images/latest.php'; This will allow you to embed the most recent camera image on any page that you are able to include a php file in. In most cases you you change the name from index.html to index.php and add the line above with and opening and closing php tag.

Ok so I hope this helps, please post comments if you get stuck anywhere in the process. I will try to help when time permits. Incidentally, this script should work for any cam configured to upload images, or in any situation where you need to display the most recent file based on last modified time. For those of you that are new, and looking to embed the camera stream, check out How to Embed a Linksys WVC54GCA Video Stream in an HTML Web Page.