As a student, I was told by an usher at the Old Bailey that I was not allowed to make any note of, or transcript of, evidence when in the public gallery. That is stranger than the 'no photograph' rule.
Such photographs were generally forbidden before 1925, but it was a matter for the judge or magistrate to regard it as contempt of court rather than as an offence in itself. There is a famous photograph, taken by hidden camera, of 'Dr' Crippen and Ethel le Neve in the dock at Bow Street. That was in 1910.
As an aside, barristers are not to permit photographers to take photos of them in robes or, worse, wig and gown, outside courts. Not that wig and gown is likely; just possible if one is going in to the High Court via the back door in Carey Street, directly from chambers in Lincoln's Inn.