The hot and dense strongly interacting matter created in collisions of heavy nuclei at RHIC energies is modeled with relativistic hydrodynamics, and the spectra of real and virtual photons produced at midrapidity in these events are calculated. Several different sources are considered, and their relative importance is compared. Specifically, we include jet fragmentation, jet-plasma interactions, the emission of radiation from the thermal medium and from primordial hard collisions. Our calculations consistently take into account jet energy loss, as evaluated in the AMY formalism. We obtain results for the spectra, the nuclear modification factor (RAAγ), and the azimuthal anisotropy (v2γ) that agree with the photon measurements performed by the PHENIX Collaboration at RHIC.