SPRINGFIELD — Although a man who was 32 wasn’t breaking the law by having sex with a 17-year-old girl in 2008, he was by photographing the act, the Illinois Supreme Court ruled Thursday.

Marshall Hollins was convicted in Stephenson County of making child pornography and sentenced to 8 years in prison. He admitted he had sex with the girl when she was 17, which is the age of sexual consent in Illinois.

In a 5-2 ruling, the high court said that although the law allows 17-year-olds to consent to sex, they are still minors, making photos or video of such sex child porn. The consequences of sexual activity are apparent to teens, but the consequences of being in pornography aren’t, the court found.

“These concerns are exacerbated in the modern digital age, where once a picture or video is uploaded to the Internet, it can never be completely erased or eradicated,’’ Justice Rita Garman wrote for the majority. “It will always be out there, hanging over the head of the person depicted performing the sexual act.’’