---
title: "Important: Page media follows the reference sorting"
manual: "Academic Programs"
version: "main"
source: "Changelog/3.0/Important-PageMediaFollowsTheReferenceSorting.rst"
rendered: "2026-09-27T09:40:45+00:00"
---

# Important: Page media follows the reference sorting {#important-page-media-follows-the-reference-sorting}

## Description {#description}

`FileReferenceCollection::getCollectionByPageIdAndField()` read
`sys_file_reference` without an ordering, so a page with several images
in one field rendered them in whatever order the database yielded — the
`sorting_foreign` an editor arranges in the media field was ignored, and
on PostgreSQL the order could differ between two renders of the same page.
The query now orders by `sorting_foreign` with `uid` settling ties.

## Impact {#impact}

Galleries and download lists built from this collection now render the images in
the order the editor arranged them on the page — which is what SQLite, MySQL and
MariaDB delivered in practice for references that were never reordered, and what
editors expressed but never got for references that were.

## Affected Installations {#affected-installations}

Every installation of this extension.
