Electron and photon energy calibration with the ATLAS detector using LHC Run 1 data