A man who committed ‘revenge porn’ offences against his ex after finding out he was not the father of a child has been jailed.