Six students who took a photo spelling out a racial slur with their T-shirts were punished after posting the image on social media.