The law is statutory and can be found in the New York Election Law:
"ARTICLE 17 VIOLATIONS OF THE ELECTIVE FRANCHISE
Sec. 17-130. Misdemeanor in relation to elections Any person who:
.....
10. Shows his ballot after it is prepared for voting, to any person so as to reveal the contents, or solicits a voter to show the same; or,
....."
A strict reading of the statute reveals that you can take a "selfie" of your ballot but you can't show it to any one.