store each photo name and thumbnail name in db