Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-20-2006, 07:46 AM   PM User | #1
jammyjames
New Coder

 
Join Date: Jun 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
jammyjames is an unknown quantity at this point
Save snapshot web camera

Hi,

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?

Thanks
jammyjames is offline   Reply With Quote
Old 11-20-2006, 01:06 PM   PM User | #2
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
Could you show us how you get the photo?
Perhaps you're using a PHP script already, or Javascripting?
mlseim is offline   Reply With Quote
Old 11-20-2006, 05:56 PM   PM User | #3
jammyjames
New Coder

 
Join Date: Jun 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
jammyjames is an unknown quantity at this point
Hi,

Ok this is the image location http://217.155.209.14:2220/SnapshotJ...ality=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
jammyjames is offline   Reply With Quote
Old 11-20-2006, 06:47 PM   PM User | #4
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
I'm just confused here ...

On this page:
http://www.yarmouthportal.com/camera/index.php

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:
http://217.155.209.14:2220/SnapshotJ...ality=Standard
mlseim is offline   Reply With Quote
Old 11-20-2006, 07:43 PM   PM User | #5
jammyjames
New Coder

 
Join Date: Jun 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
jammyjames is an unknown quantity at this point
Sorry,

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.
jammyjames is offline   Reply With Quote
Old 11-20-2006, 08:54 PM   PM User | #6
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
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?
mlseim is offline   Reply With Quote
Old 11-20-2006, 09:46 PM   PM User | #7
jammyjames
New Coder

 
Join Date: Jun 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
jammyjames is an unknown quantity at this point
This is the snapshot direct from the camera http://217.155.209.14:2220/SnapshotJ...ality=Standard

As i said everytime the page is refreshed the image will change unless it has been saved.
jammyjames is offline   Reply With Quote
Old 11-21-2006, 01:50 AM   PM User | #8
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
OK,

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.
mlseim is offline   Reply With Quote
Old 11-21-2006, 01:58 AM   PM User | #9
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,890
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
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.

Please advise.

actually, it appears possible for anyone to control that camera ... not good!
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 11-21-2006, 07:59 AM   PM User | #10
jammyjames
New Coder

 
Join Date: Jun 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
jammyjames is an unknown quantity at this point
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.

Regards
jammyjames is offline   Reply With Quote
Old 11-21-2006, 08:36 AM   PM User | #11
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,890
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
OK...
PHP Code:
<?php
/*where to get*/
$url="http://217.155.209.14:2220/SnapshotJPEG?Resolution=320x240&Quality=Standard";
/*where to put*/
$img_path='/home/fire/Desktop/snap'.mktime.'.jpg'

$yaks=file_get_contents($url);
$fp=fopen($img_path,'wb');
fputs($fp,$yaks);
fclose($fp);
?>
I put a timestamp at the end of the filename but whatever...
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 11-21-2006, 08:42 AM   PM User | #12
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,890
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
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
PHP Code:
<?php
function force_download($path){
           
$file=basename($path);
           
header("Content-Type: application/octet-stream");
           
header("Content-Type: application/force-download");
          
header("Content-Length: $size");
           
// Required to get around the MSIE 5.5 Bug of downloading filname.php
           
if(preg_match("/MSIE 5.5/"$_SERVER['HTTP_USER_AGENT']))
           {

                  
header("Content-Disposition: filename=\"$file\"");
                            } else
            {
                   
header("Content-Disposition: attachment;filename=$file");
                             }
           
//header("Content-Transfer-Encoding: binary");
           
$fh fopen($path"rb");
           
fpassthru($fh);
}
?>
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 11-21-2006, 10:08 AM   PM User | #13
jammyjames
New Coder

 
Join Date: Jun 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
jammyjames is an unknown quantity at this point
Hi

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!

Regards
jammyjames is offline   Reply With Quote
Old 11-21-2006, 02:45 PM   PM User | #14
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
James ...

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.
mlseim is offline   Reply With Quote
Old 11-21-2006, 06:47 PM   PM User | #15
jammyjames
New Coder

 
Join Date: Jun 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
jammyjames is an unknown quantity at this point
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. 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.

Regards,

James
jammyjames is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:22 AM.


Advertisement
Log in to turn off these ads.