format idx and fk name for documents and images