Hello
how can I disable the random order of photos in a post? I upload them in an order, but in Friendica the order is randomized, remotely it is in order again.
Why?
Submitted 3 weeks ago by
utzer@f.utzer.de@f.utzer.de to helpers@forum.friendi.ca
Hello
how can I disable the random order of photos in a post? I upload them in an order, but in Friendica the order is randomized, remotely it is in order again.
Why?
@utzer I think I fixed it! The screenshots below are from the Release Candidate (2026.08-rc). One of the changes to masonry layout is that if there's an odd number of images the last one now spans both columns.
As I said, by the time the array of images was getting to the masonry layout they were already in the wrong order, even though they are still in the correct order in the stored post content. It's because the functions to get the images don't go by the post content, they do a relational database search of the "post-media" table looking for rows that match the post UID number. And that is how the array of images is constructed.
Except it isn't given any sorting parameters. I couldn't figure out what the default sorting actually is, but it should be in ascending order of media ID number - because that is the same as the order the attachments are in the post body content. So I simply added those sorting parameters to the database query and now the images are in the correct order.
I'll be submitting a PR for this tomorrow to fix it in the Release Candidate.
@utzer 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:
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:
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.
utzer@f.utzer.de@f.utzer.de 3 weeks ago Sure.
Link to post
f.utzer.de/display/f5430ab4-20…
First screenshot local on Friendica with random order
Second screenshot remote on Pleroma with correct order (correct as uploaded)
randompenguin@dillyofapickle.com 3 weeks ago