She got to know Mr. Shaynak — “ShayShay” to his favorites — during her sophomore year, when she and a friend went to his classroom at lunch. He tutored them in geometry. He sometimes bought them lunch outside school. He gave one of them cigarettes.

Then, at one point, Sean Shaynak, the hip aerospace teacher in his early 40s with a flight simulator in his classroom, asked the girls if he could take pictures of them in the park, to inspire a nude painting he wanted to do. According to a friend of one of the girls whom she later confided in, they thought the request was weird and put him off, saying they were too busy. They told no one. They thought: Why ruin a teacher’s life?

But this past June, a year after one of the girls had dropped out of Brooklyn Technical High School, Mr. Shaynak sent her a picture of his penis over Snapchat, the app that lets people send messages that disappear in seconds. Horrified, the girl took a screenshot. The app notified Mr. Shaynak of the screenshot. He then sent the girl two pictures of his face looking angry.

She told friends and eventually her parents, and her father reported it to the authorities. The existence of that photograph began the unraveling of Mr. Shaynak, 44, a commercial pilot who became a Brooklyn Tech teacher in 2009 and now stands accused of preying on seven female students over three years, plying them with alcohol and cigarettes, exchanging racy text messages and photos with them, and taking one to a nude beach and another to a sex club, according to an indictment announced this week by the Brooklyn district attorney, Kenneth P. Thompson. The teacher had sex with two of the girls after they reached the legal age of consent, 17, law enforcement officials said.