update gallery layout