While typically designed to manipulate classical light, metamaterials have many potential applications for quantum optics as well. We argue why a quantum optical effective-medium theory is needed. We present such a theory for layered metamaterials that is valid for light propagation in all spatial directions, thereby generalizing earlier work for one-dimensional propagation. In contrast to classical effective-medium theory there is an additional effective parameter that describes quantum noise. Our results for metamaterials are based on a rather general Lagrangian theory for the quantum electrodynamics of media with both loss and gain. In the second part of this paper, we present a new application of transformation optics whereby local spontaneous-emission rates of quantum emitters can be designed. This follows from an analysis how electromagnetic Green functions transform under coordinate transformations. Spontaneous-emission rates can be either enhanced or suppressed using invisibility cloaks or gradient index lenses. Furthermore, the anisotropic material profile of the cloak enables the directional control of spontaneous emission.