Donald Trump will crack down on internet pornography if elected president, vowing to appoint a commission to examine its “harmful public health impact.”

News of the promise — which comes as racy photos of his wife, Melania, were obtained by The Post — is part of “The Children’s Internet Safety Presidential Pledge” from the group Enough Is Enough, which Trump signed on July 16.

The anti-porn commitment means he promises to “uphold the rule of law by aggressively enforc[ing] existing federal laws to prevent the sexual exploitation of children online, including the federal obscenity laws, child pornography laws, sexual predation laws and the sex trafficking laws.”

He also pledges to:

“Aggressively enforce the Children’s Internet Protection Act (CIPA) requiring schools and public libraries using government eRate monies to filter child pornography and pornography by requiring effective oversight by the Federal Communications Commission; “Protect and defend the innocence of America’s children by advancing public policies that prevent the sexual exploitation of children in a manner that is consistent with the government’s compelling interest in protecting its most vulnerable citizens, within the limits set forth by the First Amendment.”

Hillary Clinton has not signed the anti-porn pledge, citing a policy of not signing pledges, according to the Washington Examiner.

The racy snaps capture 25-year-old Melania Trump — then Melania Knauss — in various stages of mostly undress, and in at least one, in a nude embrace with another woman. The photos were published in a now-defunct French magazine in the 1990s.

Trump spokesman Jason Miller told CNN that the mogul is “a little more focused on the direction of the country and what we need to do to get it turned around.”

“They’re a celebration of the human body as art, and [there’s] nothing to be embarrassed about with the photos. She’s a beautiful woman,” Miller added.

Here’s what New Yorkers think about Melania Trump’s nude photos: