It does take some training to teach the dog that they won't get the treat until they do what you want, sit, lay, stand, etc. It is hard to get good pictures if the dog doesn't have basic obediance or if they are so wound up from excitment that they can't hear your commands.
We are constantly training and re-inforcing what we've trained to our dogs. Mostly we use positive re-inforcement on things they do that we want them to do on command. Like if they sit, we'll say good sit and treat them. If they lay down, we'll say good down and treat them. It doesn't take long before they associate the command with the treat. As they learn, you don't give them treats every time they do the command, but praise them. While most would rather have the treat, they like getting praise as well.
With our dogs, if we have some good we're fixing, they will go through ever trick they know on after the other hoping one of them will get our attention and they will get some of what we are fixing. And when you have dogs that can sit, lay, bow, twirl, spin, yawn, sneeze, bop, etc., it can be quit a site to watch them all going through their routine at the same time. Now if we could just teach them a "do everything" command, they could put on quit a show.
It just takes a lot of practice. Work with your dog when it's going good and stop before you start getting to frustrated and you start yelling at the dog. You can tell I've taken a lot of pictures of our dogs... when I get out my camera they all head for the living room where I have my backgrounds, lights and other equipment. They know they get treated very well for posing.
Mike