I'm not sure where to draw the line in order to protect children, but a blanket ban on posting pictures of them would never survive a First Amendment challenge. US Supreme Court precedents have made it clear that any restrictions must be more narrowly targeted.
However, the law you are proposing would prohibit a parent from posting an image of their child winning the spelling bee, in a full suit.
I have no idea how to thread this needle, outside making my personal choices.