Electromagnetic decays of the charmed and bottom baryons in chiral perturbation theory