I’ve linked a working example above
You’ll be able to copy/paste that into your app and see it under the hood.

Here’s a better explanation:

Let’s say the list of things you’re running is X

Now each item in X will probably have some text identifier. Something unique. In your case it is a URL.

What I would do is create a comma-separated text of the URLs from all the items in your list.
This looks like URL1,URL2,URL3,…
Let’s call this the URL-list

This text will also contain the URL of each item being iterated on in the :formatted as text operation.

So you can split the URL-list by this Image’s URL to get the list of URLs before the this Image’s URL in the URL-list and use that to calculate the index.

In my example, I’m doing it on a list of Users: