Optomechanical creation of magnetic fields for photons on a lattice