We present a one-dimensional quantization scheme for the electromagnetic fi
eld in arbitrary planar absorbing and dispersive dielectrics, taking into a
ccount explicitly the finite extent of media. The complete form of the elec
tric field operator includes a part that corresponds to the free fields inc
ident from the vacuum towards the medium and a particular solution which ca
n be expressed by using the classical Green-function integral representatio
n of the electromagnetic field. By expressing the classical Green function
in terms of the light modes of the dielectric structure, we obtain a natura
l generalization to absorbing media of the familiar method of mode expansio
n which strictly applies to non-absorbing media. As an application of our m
ode expansion, we obtain general quantum-optical input-output relations rel
ating the output photon operators in vacuum to the input photon operators a
nd to the reservoir noise operators. The input-output relations obtained ar
e uniquely determined by the knowledge of the classical light modes of the
planar system. We finally show that our quantization scheme for arbitrary p
lanar dielectrics satisfies the prescribed equal-time commutation relations
of QED.