Quantum theory of the electromagnetic field