David Phillips was caught on CCTV exposing himself outside the Howgate shopping centre in Falkirk.
Three police officers sent to find him after the incident in April traced Phillips to the Central Retail Park and he lashed out at them as they tried to place him under arrest.
When he appeared in court in July the 24-year-old admitted breach of the peace and assault and was placed on a community payback order with the added condition he complete unpaid work.
But he was back in Falkirk Sheriff Court last Thursday to explain why he had not complied with the order and jailed for 10 months for failing to co-operate with social workers and turn up.
The court heard that in the last five months Phillips had done just 20 of the 200 hours imposed.
Defence lawyer Neil Hay said Phillips’ “serious drug addiction” has been a factor.
Scrapping the order, Sheriff Craig Caldwell told Phillips, from 11 Jackson Avenue, Grangemouth: “Given your appalling record you were very fortunate to have been given a community-based sentence in the first place. There is now no alternative to custody.”