View Full Version : Save snapshot web camera
11-20-2006, 07:46 AM
I have a web site called www.yarmouthportal.com and I currently pay a lot of money for someone to proide me with a couple of benifits such as Saving a Snapshot and Emailing a Snapshot.
Now I am able to get a temporary (updates when the browser refreshes) snapshot from the camera but I don't know how to upload the image to my server. Currently I would have to right click then save as. I want this to be a bit more user friendly such as the one currently www.yarmouthportal.com/camera/index.php
Can anyone please help me?
11-20-2006, 01:06 PM
Could you show us how you get the photo?
11-20-2006, 05:56 PM
Ok this is the image location http://18.104.22.168:2220/SnapshotJPEG?Resolution=320x240&Quality=Standard
This is updated every time you refresh.
I want to be able to include that in my Yarmouth Portal site and then when I click "Save Snapshot" it will prompt me to save this image to my computer.
Thanks for any help
11-20-2006, 06:47 PM
I'm just confused here ...
On this page:
You already are displaying the webcam shot and there are
links to email or save. How is this different from your question?
... and this link times-out:
11-20-2006, 07:43 PM
On the Yarmouth Portal site features an existing program which I pay a lot of money every month for. I can't afford to pay it and I know that there is a way to do it myself. Somehow.
11-20-2006, 08:54 PM
So do you have a link where you can get your camera image?
.... a way to view the photo for free? (or is that part of the package)?
Somewhere along the line, that webcam is hooked up to a PC or something
that puts the image on the internet. Is that part of your system, or are you
paying for that?
11-20-2006, 09:46 PM
This is the snapshot direct from the camera http://22.214.171.124:2220/SnapshotJPEG?Resolution=320x240&Quality=Standard
As i said everytime the page is refreshed the image will change unless it has been saved.
11-21-2006, 01:50 AM
I'm going to look for a PHP solution to this.
A way to grab the image and create some options
to save or email.
Until then, someone may jump in with another solution.
11-21-2006, 01:58 AM
ok , first off who `owns` the webcamera ? and the bandwidth it uses... they need to give you permission to use images from it, if thats the case then the solution is easy, but if you don't have rights to use the image then we can't help you `grab` it here.
actually, it appears possible for anyone to control that camera ... not good!
11-21-2006, 07:59 AM
Thanks I would really appreciate the help.
The site, IP address and Web Camera are all mine and I have full rights to them.
The camera can be controlled by anyone by using up to 8 presets. This is as far as a guest user can go.
11-21-2006, 08:36 AM
/*where to get*/
/*where to put*/
I put a timestamp at the end of the filename but whatever...
11-21-2006, 08:42 AM
ah ok missed the bit about saving the image..
you could run the above code when someone clicks the 'save image' button then ... pass the img_path to something like this
// Required to get around the MSIE 5.5 Bug of downloading filname.php
if(preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT']))
$fh = fopen($path, "rb");
11-21-2006, 10:08 AM
ok code looks great.
Excuse me if I am being stupid but how would I pass the image onto the next script you posted?
I really appreciate your help! :thumbsup: :) :thumbsup:
11-21-2006, 02:45 PM
I was also looking into using PHP GD library for doing something like
putting a watermark or text directly on the image ... maybe to indicate
camera location, time, etc. Would you be interested in anything like that?
Firepages provided the good stuff for saving image, much better than the
solution I had, so go with that.
11-21-2006, 06:47 PM
Hi all I am always looking for ways to improve what I have.
Firepages, I really appreciate the help but i'm not sure how to implement this script. :o I tried just running the first script alone but it just spat loads of errors at me beginning from line 7.
If you could help me I would really appreciate it.
11-22-2006, 02:09 AM
ok you probably need to edit the permissions of where you are trying to save the image, the directory needs to be writable .. I assume those are the errors you are getting..
here's an example .. its not exactly how I would do it but you get the general idea from it.. http://www.phptoday.net/tmp.php
the tmp directory needs to be writable, on many hosts that means chmod to 0777 (if you have root you can chown the folder instead)
11-22-2006, 02:10 AM
The first example works.
I'm guessing that you don't have the CHMOD
permission set right in the folder where you
are writing the file, so you get a permission error.
In his example, he used this path:
You will use your own path, perhaps something like this:
.... where the directory "photos" will have a CHMOD of 777.
We of course, can determine what your directory structure is,
so you'll have to determine that yourself.
There is an interesting paradox though ...
When you go to your webpage and the webcam photo appears,
you may sit and look at it for a while, then decide to "save it".
So you click "save". Well, during that time that you sat and stared
at your screen, the webcam has already taken a new photo, so the
one you are looking at on your screen is older than the one that is
saved when you hit the button. See what I mean?
You'll have to determine how often the photo is updated and somehow
refresh your screen so you're seeing the newest image.