I don't know, I can't find any rhyme or reason for what order it puts things in.

Here is how my Dev Server running Friendica stable (2026.05) arranged them:
Wrong Order in Stable Release

Which is different from the order you got for the same images.

And here is how my Dev Server running Friendica Release Candidate (2026.08-rc) arranged them:
Wrong Order in Release Candidate

But if I got to "Edit" either of those all of the images are attached in the correct upload order. If I preview it in the Release Candidate my jQuery masonry simulation shows them in the correct order.

If I purposely disable masonry layout to make it use "Grid" layout they are, again, displayed in the wrong order! This is because the "Post Media Collection" array used by either masonry or grid layout has already had the order altered before it ever gets there. I've traced it back through several other files and it's already in the wrong order.

As I said, I have no clue yet WHERE it is changing the order or WHY.

When the post is federated to another platform that other platform is working from the order the images are attached to the post body, which is not getting changed by Friendica. Like I said, if you go to edit it, if you quote share it, on Friendica the order will be correct. It's only be altered when it displays the published post in Friendica.

I'll keep poking around in the code and hopefully I can find and fix it, but right now I'm not sure where else to look.