Carl perceives the zombies as a threat but a manageable one. He had a mission and wanted to prove that he could do it. He's struggling to find some solace in his life and I think that photo meant more to him than life itself.
I get what you're saying. And I can understand why you, and others, accept what Carl did in the last episode.
But I am tired of him as a character. At the prison, he was demonstrating real competence and maturity. But then, he goes on this really questionable mission to grab a photo, and he reverts back to Carl of the second season: the kid who wanders around recklessly whenever the show needs to pump up the suspense.