There are a lot of projects that use the Pi in this way. You can use a standard USB webcam or the camera module that is specific to the Pi. The software you need is called Motion - search the internet for details, and see if you can find a project that is similar to what you need. One you can look at is here:
http://www.codeproject.com/Articles/665 ... nce-camera (perhaps does more than you want)
You need to decide a few things, such as how you are supplying power, where will the Pi / camera be mounted, what sort of network connection you will use, where you want to store your pictures, and will you have it running all day or just part of the time? You have given the two models at the ends of the selection range, a Pi2 is more powerful if processing your pictures is important and the PiZero uses less power; the different cost of the Pis will not be significant so I would probably start with a Pi2. You should be able to swap it for a different model when you have it working if you change your mind