Sir John Thomas sitting at the High Court ruled that the two men were in breach of the injunction and therefore in contempt of court.
Reflecting on the "gravity" of their offence he said they would be given nine months imprisonment but because of mitigating circumstances it would be suspended.
More top news
Slovakia and the Czech Republic call for a collective rejection with Hungary and Poland to accept a mandatory quota of refugees.
A 25-year-old man has been arrested for urinating on the Cenotaph in Whitehall and pulling down commemorative wreaths.
A Bank Holiday washout has left many Britons running for cover, with a fortnight's worth of rain expected on Monday.