How to load gallery on dynamic page from dataset

How about a for-loop from 1 to 20, adding 1,2,3 to “pic”, getting it from collection and then .push it onto an array?