Multiple images into an array in chunks 5.6.2.1

Permalink
I am using the Multiple File / Image attribute to allow the user to upload a group of images to a page in composer. What I need to do is turn the group of images into an array so I can break it into chunks on the page.

Say there are 24 images total. I need the first two at the top of the page, then some text, then another group of two, then a video, then another group of three, then some more text, then the rest of the images in another group.

I know I could create multiple sets and display those accordingly. But, it's a requirement that they only upload one group of images.

Can someone show me the code for doing this? Not sure how to get them into an array. I am also not sure how I would chunk that array to fit my need.

Thanks in advance!

 
JohntheFish replied on at Permalink Reply
JohntheFish
Assuming you can code a little PHP:
(a)
Upload the files to a set for the page. Use the fileset sorter to get them into order.
Look at the list files from set addon and my image list templates for it (both free). Develop versions of the template that show files1&2, files 3&4 etc
Insert the block with those templates at relevant points into the page.

With a bit more PHP
(b)
Similar to above, but rather than list files from set, you develop a new block based on it with a modified block controller, or a block controller override for list files from set, that reads the page attribute (that is the multifile attribute) to list the files. Rest as (a).

No PHP
(c)
You can do similar to either of (a) or(b) without writing php using my Magic Data addon to:
List a fileset or read the attribute value as a list
At each stage pick the relevant files from that list
Generate images from the picked files