Procurator fiscal depute Claire Bremner told the court police cyber crime officers searched a mobile phone seized at an address in Glasgow and found a WhatsApp conversation linked to Gallagher’s phone.
This conversation was found to contain indecent images of children and discussed abuse of children.
Police searched Gallagher’s home address and found 36 indecent images on one phone and one image on another.
Defence lawyer Chris Sneddon said Gallagher, of William Laing Crescent in Leven, had no previous convictions.
Sheriff Ian Anderson adjourned sentencing until August 30 for the production of background reports and Gallagher was placed on the Sex Offenders Register.