Quantum electrodynamics of an atom in front of a dielectric slab