A former primary school teacher who admitted making indecent pictures of children has been banned from teaching for life.