nested relationship gallery to image