auto resize of gallery