What was the dog wondering about? Maybe he was wondering who the guy in the photograph is.
I expect all the wondering got him to wandering and then he got lost.