WebCam v2.1
This is a java applet that runs in a web page and displays an image of any size. It defaults to use a 240x320 image. It reloads the image every x seconds. It supports animated waiting/loading images and an online/offline status.

*************************************************************
NOTE: This will not work with IE anymore because Microsoft caches the image.  If you can find a fix for this, let me know how and I'll modify my source.
UPDATE: 5/11/05 - Thanks to to PPJM for this trick.....to get around the cache problem in IE, put a question mark at the end of the file name in your webcam.conf, like "image1=cam1image.jpg?". The actual image file can still be cam1image.jpg.
*************************************************************

The source code

Put this code on the web page where you want a web cam.

<applet code=webcam.class width=320 height=270>
<param name=CamNum value="1">
You need to enable java.
</applet>

Note: Width and height refer to the size of the java applet NOT the cam cam image.
The cam image size is set by the ImgWidth and ImgHeight paramaters.
The height has to be bigger than the image height so as to display the status info and logo.

What they mean:
CamNum - used to get the settings from the config file. Can be 1 - 9.
ImgWidth - width of the picture, defaults to 320
ImgHeight - height of the picture, defaults to 240
ImgBlinkX - horizontal position of blinking LEDs, defaults to 5
(wait1.gif,wait2.gif,uploading.gif)
use 0 to hide it
ImgLogoX - horizontal position of the logo, defaults to 75
use 0 to hide it
ImgStatusX - horizontal position of the online/offline
defaults to 250
use 0 to hide it

By putting the real stuff in a config file instead of just passing them as parameters makes things more secure because users can't see the name of the main image file so they can not grab it on thier own and they can not specify their own delay time.

Other files
You will need these files in the same directory as your html code:

webcam.class - the java applet
online.gif
offline.gif
wait1.gif - "status" image shown when offline
Also shown every other second when online. Useful for "blinking" effect.
wait2.gif - "status" image shown every other second when online
upload.gif - animated gif shown when image being uploaded
logo.jpg - you can put your own logo here
webcam.conf - the configuration file. See below.


You also need the cam image you want to display and the status file. These are defined in the webcam.conf file. The status file is just a text file that should contain a "1" to set the cam online or a "0" to make it offine. It must be in online mode for it to keep reloading the image.

Sample webcam.conf file:
#webcam.conf
#There are 3 entries for each cam you want to handle
#Supports up to 9 cams
#
#image to display
image1=camimg.jpg

#number of seconds between pictures
delay1=120

#name of status file that determines if can is online or not
#contains a 1 or 0,1=online
statusfile1=status.txt

Download The Applet
Download webcam.zip. It contains the applet,image files,config files and source code.











copyright 2010, worldofjon.com