I see the を particle is used with the verb, but I don't know how it works in the sentence. Is it:
The former is the full sentence without any ambiguity. とる has a lot of meanings (including 捕る "to capture" and 盗る "to steal"). You have to specify which とる you are using in some way or another.
You can use the latter sentence if the context makes it clear that you're talking about photos. You don't have to say 写真【しゃしん】(を) again and again.
A: しゃしんはすきですか？ Do you like photography?
B: はい。きのうはこうえんでいぬをとりました。 Yes. Yesterday I took photos of my dog at a park.
And as you can see, とる has lots of kanji, and the kanji for "to take (a photo)" is 撮る, which is specific enough. So in written Japanese you can simply write like this:
I took a picture of a dog at the park.