add function of gallery to trim