Sounds like the teacher had the nude photo on the iPad that the school issued to her. They boys somehow were browsing on the iPad and found the photo.
teacher had a topless pic on her iPhone that somehow synched to the students’ school-issued iPad and shared the pic.