Hard-photon production within a self-consistent transport approach to heavy-ion collisions