We present a quantum-field theoretical model to explain the experimentally suggested spatial localization of photons associated with the coherent state of phonons in an optical near-field probe system. Considering the localized phonon modes due to the impurity in a one-dimensional system, we have obtained the temporal evolution of the localization of photons, which depends on the photon-phonon coupling constant, as well as the hopping constant of photons. Numerical results show that photons move and localize at the impurity sites when the hopping constant is comparable to the photon-phonon coupling.