Extract attachment IDs from selection, reinsert as gallery shortcode.