Of course, there are many variants to take pictures with your raspberry pi camera and save them somewhere.
I use my raspberry pi camera to observe my flat when I am away. I want to do this in a as secure way as possible, i.e., I do not want to open any special ports on my router nor do I want to send unencrypted images over the web.
Inspired by http://blog.davidsingleton.org/raspberry-pi-webcam-a-gentle-intro-to-crontab/ my idea was to take a photo every 5 or 10 minutes and save them to my ownCloud server via WebDAV with SSL encryption.
Step by step:
1.) Make sure you have a raspberry pi with a camera module and an owncloud installation reachable over https somewhere out in the web (with picture app activated).
2.) Mount your owncloud drive on your raspberry pi: Create the directory /home/pi/owncloud and add the following line to fstab:
https://[your.owncloud.domain.name]/remote.php/webdav/ /home/pi/owncloud davfs rw,noexec,noauto,user,async,_netdev,uid=pi,gid=pi 0 0
then mount the drive by calling mount owncloud/ or by calling echo -e “y” | mount owncloud/ if your server has a self-signed certificate as mine has.
3.) My idea is to take a picture, say, every 10 minutes, and take them for 24 hours with any need to remove them manually. So, write a script like the following, name it “take_photo.sh” and make it executable:
#!/bin/bash filename="/home/pi/owncloud/myflat_$(date +%H%M).jpg" raspistill -o /home/pi/image.jpg mv /home/pi/image.jpg $filename
4.) Set up the crontab by calling crontab -e and add the following line:
*/10 * * * * /home/pi/take_photo.sh
5.) You are finished. Raspberry pi will take every 10 minutes a photo and save them to your ownCloud where you have a beautiful picture viewer that you can access wherever you are on whatever for a device.