Relativistic Effects and Gauge Invariance in Photon Absorption and Scattering