So I run a CCTV system based on the excellent open source Zoneminder, running on a pretty entry level ex-lease PC I bought from PBTech.
What I want to do is embed one of the cameras into a web site.
So my steps are going to be:
Setup a Zoneminder user for public access.
Write a small PHP proxy script.
Profit!
Prerequisites
I’m not going to talk you through setting up a Debian server.
Nor am I going to talk you through setting up a Zoneminder server on a Debian server.
I will assume that you have these things running.
I’ll also assume that you have the Zoneminder console running from a virtual sub directory in Apache (in my case /zm/ ).
But just in case, here’s a quick reminder of the Apache config:
Zoneminder read only user
Right, let’s start with a Zoneminder “read only” user.
In your Zoneminder console, head to Options->User, and smash that “ADD NEW USER” button.
Pretty straight forward:
Username = YOURPUBLICUSER
Password = YOURPUBLICPASS
Confirm Password = YOURPUBLICPASS
Language
Enabled = yes
Stream = View
Events = None
Control = None
Monitors = View
Groups = None
System = None
Max bandwidth = whatever you like
Restricted monitors = Select the Cameras you want available publicly.
API Enabled = No
Save that bad boy.
That’s step 1 done 😊
A PHP Proxy script
So at this point you could just jam an image in any web site, using a specially crafted URL: http://YOUR-ZONEMINDER-CCTV-URL/zm/cgi-bin/nph-zms?monitor=1&user=YOURPUBLICUSER&pass=YOURPUBLICPASS
But, that kinda exposes, well, everything ! Your CCTV url, your readonly user and pass. I dunno, it just doesn’t seem right to me 🤣
So, I’m going to craft a small PHP proxy script which will hide this info from public view.
That’s it; save that PHP script as .. I dunno .. zoneminder_stream.php ?
Embed in HTML
Here’s the fun bit .. simple HTML ! <img src="/path/to/zoneminder_stream.php" alt="my stream" />
Your article “Streaming A Zoneminder Monitor To A Web Site” was very helpful and got me on track quickly after a bit of stumbled through making it work over https. Thanks so much for the help with our streaming “bubble cam”. You rock! Feel free to drop in and blow bubbles in our back yard.
1 Comment