Getting an array of images according to the count displayed in URL

I’ve made an automation where make is pulling a URL that holds a group of images.

The URL looks like this as an example:
https://website.com/groupimageurl~1/

If the group of images had 5 images, the URL would look like this:
https://website.com/groupimageurl~5/

Every image is at a subsequent address that looks like this:
https://website.com/groupimageurl~5/nth/0/
https://website.com/groupimageurl~5/nth/1/
https://website.com/groupimageurl~5/nth/2/
https://website.com/groupimageurl~5/nth/3/
https://website.com/groupimageurl~5/nth/4/

Here’s what that looks like mapped in make:

The pink tag that says “multi-image” is generating the unique URL.

This is working nicely! As long as I have a group of exactly 5 images!

It it’s less, it will fail to upload to my CMS (webflow multi-image field).

My question is this:
Is there a way to tell make.com to look at the URL for the number of images available (that last part that says “~5” means there are 5 images. If it said “~4” I would want it to only try to retrieve 4).

In other words, can I have make look at the last few characters of that URL and make a decision based off of that?

I hope this makes sense! Thanks for your time.

I’m basically trying to tell make:

"If this URL contains “~2”, then give value A
If it does not contain “~2”, then leave this blank

I just don’t know how to write that out.

What you want to do is,

  1. Add a repeater that will have an initial value of 1 and repeat to value will be,

parseNumber(last(split(producturl;~)))

  1. Use Array aggregator after the iterator, whereby set the Target structure type as Product Image Gallery and there set the URL for product images which will be,

mutli_imagenth/{iterator_output}

  1. In the Product Image Gallery, Use the Map option and set the output of array iterator there

image

For the array aggregator, do I need custom variables? Does that URL value look right?

{iterator_ouput} will be the output of repeater, it will be i.

1 Like


Brilliant! It worked! I don’t know what magic this is, but thanks.