Staljabro
Posts: 3
Joined: Tue Jul 23, 2013 11:57 am

Take photo on keypress, and send to email address...

Sat Jul 27, 2013 12:16 am

Hi guys,
Pretty much just what the title says. How would I go about programming the pi to take a photo on a keypress (ie. spacebar etc) and then automatically send the photo in an email to a specified email address? I know absolutely no programming languages for the pi (I design websites with HTML, PHP, and CSS, but that's about it) but I realize that they are no use in this application. Also, I don't have the camera module, but I was considering using a USB webcam instead.

Thanks in advance for your help

txt3rob
Posts: 365
Joined: Sat Aug 11, 2012 3:45 pm
Contact: Website

Re: Take photo on keypress, and send to email address...

Mon Jul 29, 2013 10:24 am

you would be best to use the webcam and then install motion "sudo apt-get install motion"

read up the guides on how to set it up.

You would then have issues with spacebar i suppose but you should be able to do shell_exec to run a bash script to take the photo and email it but you would need apache or nginx running as root priv.
The Raspberry Pi Hell Guy - Random Ramblings to assist me and others.
http://raspberrypihell.blogspot.com
My Github - http:/www.github.com/random-robbie/
http://www.smspi.co.uk - send free uk sms via your raspberry pi from here

mindmasta
Posts: 58
Joined: Tue Feb 12, 2013 8:29 pm

Re: Take photo on keypress, and send to email address...

Thu Aug 29, 2013 5:38 pm

I use motion to stream video and it has a setting to take snapshots at intervals. there is also UVCCapture, which allows you to take a snapshot on demand.

What I've done is create a small PHP page that is hosted on the Pi. When I click a button on the page, it creates a simple file on the Pi called "snap".... the Pi is running a Python script continually that looks for the "snap" file... when it sees it, it takes a snapshot w/ the cam and FTPs it to another server that I have.

Using this method I am also able to send commands to the web cam (which is on a servo motor) to have it move around. Instead of FTPing the picture, It can also be emailed or sent via SMS.

Since you know how to make webpages already, that first part might be easy enough.... If you don't know any other languages on the Pi, Python might faster & easier to read/learn initially than C/C++


Good luck!

Chris_J
Posts: 42
Joined: Wed Sep 18, 2013 3:14 pm

Re: Take photo on keypress, and send to email address...

Tue Dec 03, 2013 12:52 pm

This is a really interesting topic.

I'm looking to do something similar. I think I have the methods in order to trigger the camera and then get the image into the Pi. The next step is to have the Pi listening in for new images and then either FTPing or emailing them out.

Is this a job for Python?

Chris

Return to “General programming discussion”