Naked WebCam TimeStamp
I have the Hawking HNC320W and the HNC320G
webcams, and I like them because they were cheap and gave me a
real good image. I also have a more expensive 4XEM, and I hate it
because the image quality is awful. Trouble was, there was no way
(that I could see) to get an FTP image from the Hawking cameras
with a timestamp on it.
Darn Hawkings gave me a 'naked' image (no text at all) when FTP'd to my website. Well, recently, I was playing around with PHP scripts, and discovered that I can display the date and time that a file (on the server) was modified, and set out to come up with a quick and simple way to use that with my Hawking web cams.
Now that I've fingered this out, I have timestamps on my 'non-timestamped' FTP'd webcam images. Since I was not able to find this functionality anywhere else on the Internet is the reason I'm posting it. I hope that someone may find this usefull.
Here is a sample; which is named 'camsample.php'. In this sample, the images are in the same directory as the script. Sticklers for correct HTML format will snort at it, but this works and it's simple.
camsample.php <?php |
Here is the code it generates when executed: <center><font size="6">My Web Cam Example</font></center><br><table align="center" border ="2"><TR><TD border= "2" width= "640" align= "center"; height= "480" background = "drive61.jpg" valign= "top"<b><span style="background-color: #FFFFFF"><font size="3">- Image Uploaded: April 20 2009 13:11:55 ADT -</font></center></td></tr></table> |
On some servers, line 7 (putenv("TZ=whatever";) may not be needed, depending on whether they default to UTC time stamps or the local time stamps. The sample shown puts the timestamp at the top of the image; to change it to the bottom, just change the 'valign' statement from 'top' to 'bottom'.
Check out my sample (from the code shown above) here (there is no webcam feeding the sample page) or a more elegant 'live' implementation here. Thanks to Don, VE3COE who led me to some of the ideas used in the sample code. You can see his implementation here.
My personal favorite 'simple' implementation is here. This one doesn't try to put text over the image or anything tricky like that; it just puts the timestamp above the image, and that's that. This method does not give problems with printing like the 'background' implementation, or problems with text position in the 'absolute location' method of putting text over the image.