Direct imaging of long-range ferromagnetic and antiferromagnetic order in a dipolar metamaterial