update gallery to make it vertical align middle dynamically