Gravitational lensing is a powerful tool for elucidating the origin of gamma-ray emission from distant sources. Cosmic lenses magnify the emission and produce time delays between mirage images. Gravitationally-induced time delays depend on the position of the emitting regions in the source plane. Temporal resolution at gamma-ray energies can be used to measure these time delays, which, in turn, can be used to resolve the origin of the gamma-ray flares spatially. As a prototypical example of the power of lensing combined with long, uniformly sampled light curves provided by the Fermi satellite, we investigated the spatial origin of gamma-ray flares from two known gravitationally lensed sources: PKS 1830-211 and B2 0218+35.