Image copyright Getty Images Image caption When asked if she was relieved, Mathers told reporters "no comment".

A Playboy centrefold model has reached a plea deal with prosecutors after she posted a photo online that authorities say was an invasion of privacy.

Dani Mathers, 30, pleaded no contest to posting a nude photo of an elderly woman preparing to shower in the locker room at a Los Angeles gym.

The 2015 Playmate of the Year was given the option of 45 days in jail or 30 days of community labour.

She chose the latter and will be removing graffiti.

Mathers had been globally criticised after posting the photo of the unsuspecting woman on social media platform Snapchat with the denigrating caption: "If I can't unsee this then you can't either."

Image copyright Dani Mathers Image caption The picture (edited by the BBC) which Dani Mathers posted of a naked women in the changing room

At a Los Angeles courthouse on Wednesday her lawyers changed her plea from "not guilty" to "no contest" after a 20-minute meeting with prosecutors and the judge.

As part of her plea deal, she will be placed on three years of probation and is banned from using a mobile phone "in any place where persons are in a state of undress or have an expectation of privacy," said judge Gustavo Sztraicher.

Image copyright AFP

She is also banned from posting images of people online without their express permission, and must destroy all copies of the offending image.

She was also ordered to stay 100 yards (metres) from her victim and pay her $60 (£46) in restitution.

"Dani is very relieved that this is over," said her attorney Tom Mesereau.

"She pleaded no contest to a misdemeanour, she won't do a day in jail for that and she wants - to get on with her life," he continued.

More on body-shaming

Media playback is unsupported on your device Media caption Two women's different stories of fat shaming

WATCH: Two women's stories of fat shaming

Pregnant Walking Dead star leaves Instagram over body-shaming