A police officer who set up a fake Twitter account to publish sexually explicit images of himself has been barred from policing.