Although there is no specific law against taking selfies or photographs of any kind in polling stations, the law of protecting the "secrecy of the ballot" is clear - it is illegal to reveal how someone else has voted. Additionally, taking a photo of a ballot paper's unique identification number is against the rules.
In short, it is illegal to release any information "obtained in a polling station," and being found guilty of doing so can result in a fine of up to £5,000 or six months in prison, as was warned in the run-up to the European elections in May 2014.
The Electoral Commissions says: "Due to the potential breach of the law, intentionally or not, we strongly advise against any form of photography taken inside a polling station. However, if a voter would like to highlight their participation in the elections, we suggest this is done outside the polling station before or after they vote." As a result, many polling stations are likely to display "no photography" signs.
Revealing how someone else has voted is in breach of Section 66 of the Representation of the People's Act, and specifically it is against the law to "directly or indirectly induce a voter to display his ballot paper after he has marked it so as to make known to any person the name of the candidate for whom he has or has not voted."
In reality, polling staff are more likely to ask you to delete any offending photos, rather than immediately call the police.
Don't tweet while you vote
The Electoral Commission also warns against tweeting from polling stations - even about your own vote, which is not an offence. But, as above, there are strict laws against revealing how other people have voted, and even against influencing whether they disclose who they voted for to anyone, online or offline.